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
1=== modified file 'lib/libbamf/bamf-application.c'
2--- lib/libbamf/bamf-application.c 2012-04-26 17:11:45 +0000
3+++ lib/libbamf/bamf-application.c 2012-05-17 05:09:20 +0000
4@@ -249,6 +249,8 @@
5 BamfView *view;
6 BamfFactory *factory;
7
8+ g_return_if_fail (BAMF_IS_APPLICATION (self));
9+
10 factory = bamf_factory_get_default ();
11 view = bamf_factory_view_for_path_type (factory, path, BAMF_FACTORY_WINDOW);
12
13@@ -271,6 +273,8 @@
14 BamfView *view;
15 BamfFactory *factory;
16
17+ g_return_if_fail (BAMF_IS_APPLICATION (self));
18+
19 factory = bamf_factory_get_default ();
20 view = bamf_factory_view_for_path_type (factory, path, BAMF_FACTORY_WINDOW);
21
22@@ -312,6 +316,12 @@
23 priv->desktop_file = NULL;
24 }
25
26+ if (priv->cached_xids)
27+ {
28+ g_list_free (priv->cached_xids);
29+ priv->cached_xids = NULL;
30+ }
31+
32 if (priv->proxy)
33 {
34 dbus_g_proxy_disconnect_signal (priv->proxy,
35@@ -328,12 +338,6 @@
36 priv->proxy = NULL;
37 }
38
39- if (priv->cached_xids)
40- {
41- g_list_free (priv->cached_xids);
42- priv->cached_xids = NULL;
43- }
44-
45 if (G_OBJECT_CLASS (bamf_application_parent_class)->dispose)
46 G_OBJECT_CLASS (bamf_application_parent_class)->dispose (object);
47 }

Subscribers

People subscribed via source and target branches