Merge lp:~mterry/libdbusmenu/749609 into lp:libdbusmenu/0.5

Proposed by Michael Terry
Status: Merged
Merged at revision: 289
Proposed branch: lp:~mterry/libdbusmenu/749609
Merge into: lp:libdbusmenu/0.5
Diff against target: 29 lines (+5/-0)
1 file modified
libdbusmenu-glib/client.c (+5/-0)
To merge this branch: bzr merge lp:~mterry/libdbusmenu/749609
Reviewer Review Type Date Requested Status
DBus Menu Team Pending
Review via email: mp+56398@code.launchpad.net

Description of the change

When looking at bug 749609, I realized that what was happening was that the menuproxy object was living longer than the client object. So it's callbacks were still happening and trying to access dead client object memory.

So one thing I did to reduce bug surface area was to disconnect all signals with the client object as callback data (there are three such callbacks in client.c).

Secondly, I looked at why the menuproxy might be surviving longer than the client. While async calls are ongoing, the menuproxy has an additional ref, and I started looking there. Most of the async calls ref the client object for the lifetime of the call to avoid this problem, but one async call didn't (the "Event" call), so I added a ref there.

To post a comment you must log in.
lp:~mterry/libdbusmenu/749609 updated
289. By Michael Terry

fix typo

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-glib/client.c'
2--- libdbusmenu-glib/client.c 2011-03-29 02:24:01 +0000
3+++ libdbusmenu-glib/client.c 2011-04-05 16:15:26 +0000
4@@ -441,6 +441,9 @@
5 priv->menuproxy_cancel = NULL;
6 }
7 if (priv->menuproxy != NULL) {
8+ g_signal_handlers_disconnect_matched(priv->menuproxy,
9+ G_SIGNAL_MATCH_DATA,
10+ 0, 0, NULL, NULL, object);
11 g_object_unref(G_OBJECT(priv->menuproxy));
12 priv->menuproxy = NULL;
13 }
14@@ -1494,6 +1497,7 @@
15 g_variant_unref(edata->variant);
16 g_free(edata->event);
17 g_object_unref(edata->menuitem);
18+ g_object_unref(edata->client);
19 g_free(edata);
20
21 if (G_UNLIKELY(error != NULL)) {
22@@ -1528,6 +1532,7 @@
23
24 event_data_t * edata = g_new0(event_data_t, 1);
25 edata->client = client;
26+ g_object_ref(client);
27 edata->menuitem = mi;
28 g_object_ref(edata->menuitem);
29 edata->event = g_strdup(name);

Subscribers

People subscribed via source and target branches