Merge lp:~3v1n0/bamf/fix-window-removed-crash into lp:bamf/0.4

Proposed by Marco Trevisan (Treviño) on 2012-05-17
Status: Merged
Merged at revision: 463
Proposed branch: lp:~3v1n0/bamf/fix-window-removed-crash
Merge into: lp:bamf/0.4
Diff against target: 47 lines (+10/-6)
1 file modified
lib/libbamf/bamf-application.c (+10/-6)
To merge this branch: bzr merge lp:~3v1n0/bamf/fix-window-removed-crash
Reviewer Review Type Date Requested Status
Gord Allott (community) 2012-05-17 Approve on 2012-05-22
Review via email: mp+106112@code.launchpad.net

Commit message

libbamf, BamfApplication: add a sanity check to prevent crash on signals

Description of the change

Applying this fix lp:~3v1n0/unity/quick-app-reopen-icon-fix can happen that, even if we disconnect from the "WindowRemoved" dbus signal in BamfApplication's dispose, bamf_application_on_window_removed gets called anyway, so that it causes a crash since the pointed application is not valid anymore.

Adding a sanity check fixes this crash.

To post a comment you must log in.
Gord Allott (gordallott) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/libbamf/bamf-application.c'
--- lib/libbamf/bamf-application.c 2012-04-26 17:11:45 +0000
+++ lib/libbamf/bamf-application.c 2012-05-17 05:09:20 +0000
@@ -249,6 +249,8 @@
249 BamfView *view;249 BamfView *view;
250 BamfFactory *factory;250 BamfFactory *factory;
251251
252 g_return_if_fail (BAMF_IS_APPLICATION (self));
253
252 factory = bamf_factory_get_default ();254 factory = bamf_factory_get_default ();
253 view = bamf_factory_view_for_path_type (factory, path, BAMF_FACTORY_WINDOW);255 view = bamf_factory_view_for_path_type (factory, path, BAMF_FACTORY_WINDOW);
254256
@@ -271,6 +273,8 @@
271 BamfView *view;273 BamfView *view;
272 BamfFactory *factory;274 BamfFactory *factory;
273275
276 g_return_if_fail (BAMF_IS_APPLICATION (self));
277
274 factory = bamf_factory_get_default ();278 factory = bamf_factory_get_default ();
275 view = bamf_factory_view_for_path_type (factory, path, BAMF_FACTORY_WINDOW);279 view = bamf_factory_view_for_path_type (factory, path, BAMF_FACTORY_WINDOW);
276280
@@ -312,6 +316,12 @@
312 priv->desktop_file = NULL;316 priv->desktop_file = NULL;
313 }317 }
314318
319 if (priv->cached_xids)
320 {
321 g_list_free (priv->cached_xids);
322 priv->cached_xids = NULL;
323 }
324
315 if (priv->proxy)325 if (priv->proxy)
316 {326 {
317 dbus_g_proxy_disconnect_signal (priv->proxy,327 dbus_g_proxy_disconnect_signal (priv->proxy,
@@ -328,12 +338,6 @@
328 priv->proxy = NULL;338 priv->proxy = NULL;
329 }339 }
330340
331 if (priv->cached_xids)
332 {
333 g_list_free (priv->cached_xids);
334 priv->cached_xids = NULL;
335 }
336
337 if (G_OBJECT_CLASS (bamf_application_parent_class)->dispose)341 if (G_OBJECT_CLASS (bamf_application_parent_class)->dispose)
338 G_OBJECT_CLASS (bamf_application_parent_class)->dispose (object);342 G_OBJECT_CLASS (bamf_application_parent_class)->dispose (object);
339}343}

Subscribers

People subscribed via source and target branches