Merge lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive into lp:bamf/0.4

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: 472
Merged at revision: 470
Proposed branch: lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive
Merge into: lp:bamf/0.4
Diff against target: 159 lines (+27/-30)
2 files modified
lib/libbamf/bamf-factory.c (+3/-2)
lib/libbamf/bamf-view.c (+24/-28)
To merge this branch: bzr merge lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+109971@code.launchpad.net

Commit message

libbamf, bamf-view: don't unset the proxy on closed sticky views

Also, don't reset the proxy if the current one is still valid.

Description of the change

When a sticky bamf view is closed, libbamf used to unset its dbus proxy; this is generally right, but in some tricky cases (hard to debug, mostly timing dependent) it caused that when the same application was opened again, the newly set proxy was not notified when a signal was emitted by the server.
This lead to bug #978401

To fix this, we don't unset the proxy of a sticky application when the related dbus object is closed, so that it will stay alive and will automatically reconnect to signals when the object will be exported again.

Also, now if we try to set the path of a view without changing it, we just ignore the request and we continue with the proxy that we already have.

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

Works fine

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-bamf/71/console reported an error when processing this lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive branch.
Not merging it.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-bamf/72/console reported an error when processing this lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive branch.
Not merging it.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-bamf/73/console reported an error when processing this lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive branch.
Not merging it.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-bamf/74/console reported an error when processing this lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive branch.
Not merging it.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-bamf/75/console reported an error when processing this lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive branch.
Not merging it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/libbamf/bamf-factory.c'
2--- lib/libbamf/bamf-factory.c 2012-05-24 20:25:51 +0000
3+++ lib/libbamf/bamf-factory.c 2012-06-15 15:29:24 +0000
4@@ -107,6 +107,7 @@
5 {
6 g_return_if_fail (BAMF_IS_FACTORY (self));
7 self->priv->local_views = g_list_remove (self->priv->local_views, view);
8+ self->priv->registered_views = g_list_remove (self->priv->registered_views, view);
9 }
10
11 static void
12@@ -204,9 +205,9 @@
13 return _bamf_factory_view_for_path_type (factory, path, factory_type);
14 }
15
16-BamfView *
17+BamfView *
18 _bamf_factory_view_for_path_type (BamfFactory * factory, const char * path,
19- BamfFactoryViewType type)
20+ BamfFactoryViewType type)
21 {
22 GHashTable *views;
23 BamfView *view;
24
25=== modified file 'lib/libbamf/bamf-view.c'
26--- lib/libbamf/bamf-view.c 2012-05-24 20:25:51 +0000
27+++ lib/libbamf/bamf-view.c 2012-06-15 15:29:24 +0000
28@@ -67,7 +67,7 @@
29 URGENT_CHANGED,
30 VISIBLE_CHANGED,
31 NAME_CHANGED,
32-
33+
34 LAST_SIGNAL,
35 };
36
37@@ -415,7 +415,10 @@
38 gboolean
39 _bamf_view_remote_ready (BamfView *view)
40 {
41- return BAMF_IS_VIEW (view) && view->priv->proxy;
42+ if (BAMF_IS_VIEW (view) && view->priv->proxy)
43+ return !view->priv->is_closed;
44+
45+ return FALSE;
46 }
47
48 const gchar *
49@@ -552,6 +555,9 @@
50
51 view->priv->checked_flags = 0x0;
52 view->priv->proxy = NULL;
53+
54+ g_free (view->priv->path);
55+ view->priv->path = NULL;
56 }
57
58 static void
59@@ -569,22 +575,9 @@
60 priv->cached_children = NULL;
61 }
62
63- if (priv->sticky)
64- {
65- bamf_view_unset_proxy (self);
66- }
67-
68 g_object_ref (self);
69-
70- // must be emitted before path is cleared as path is utilized in cleanup
71+
72 g_signal_emit (G_OBJECT (self), view_signals[CLOSED], 0);
73-
74- if (priv->path)
75- {
76- g_free (priv->path);
77- priv->path = NULL;
78- }
79-
80 g_object_unref (self);
81 }
82
83@@ -608,7 +601,7 @@
84 switch (property_id)
85 {
86 case PROP_PATH:
87- g_value_set_string (value, self->priv->path);
88+ g_value_set_string (value, self->priv->is_closed ? NULL : self->priv->path);
89 break;
90
91 case PROP_ACTIVE:
92@@ -728,11 +721,11 @@
93 G_OBJECT_CLASS (bamf_view_parent_class)->dispose (object);
94 }
95
96-const char *
97+const char *
98 _bamf_view_get_path (BamfView *view)
99 {
100 g_return_val_if_fail (BAMF_IS_VIEW (view), NULL);
101-
102+
103 return view->priv->path;
104 }
105
106@@ -774,17 +767,20 @@
107 _bamf_view_set_path (BamfView *view, const char *path)
108 {
109 BamfViewPrivate *priv;
110-
111+
112 g_return_if_fail (BAMF_IS_VIEW (view));
113-
114+ g_return_if_fail (path);
115+
116 priv = view->priv;
117 priv->is_closed = FALSE;
118
119- if (priv->path)
120+ if (priv->proxy && g_strcmp0 (priv->path, path) == 0)
121 {
122- g_free (priv->path);
123+ // The proxy path has not been changed, no need to unset and re-set it again
124+ return;
125 }
126
127+ g_free (priv->path);
128 bamf_view_unset_proxy (view);
129
130 priv->path = g_strdup (path);
131@@ -824,15 +820,15 @@
132 "RunningChanged",
133 G_TYPE_BOOLEAN,
134 G_TYPE_INVALID);
135-
136+
137 dbus_g_proxy_add_signal (priv->proxy,
138 "UrgentChanged",
139- G_TYPE_BOOLEAN,
140+ G_TYPE_BOOLEAN,
141 G_TYPE_INVALID);
142-
143+
144 dbus_g_proxy_add_signal (priv->proxy,
145 "UserVisibleChanged",
146- G_TYPE_BOOLEAN,
147+ G_TYPE_BOOLEAN,
148 G_TYPE_INVALID);
149
150 dbus_g_proxy_add_signal (priv->proxy,
151@@ -876,7 +872,7 @@
152 (GCallback) bamf_view_on_urgent_changed,
153 view,
154 NULL);
155-
156+
157 dbus_g_proxy_connect_signal (priv->proxy,
158 "UserVisibleChanged",
159 (GCallback) bamf_view_on_user_visible_changed,

Subscribers

People subscribed via source and target branches