ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #03207
[Merge] lp:~ted/dbusmenu/signals-do-crazy-shit into lp:dbusmenu
Ted Gould has proposed merging lp:~ted/dbusmenu/signals-do-crazy-shit into lp:dbusmenu.
Requested reviews:
DBus Menu Team (dbusmenu-team)
For more details, see:
https://code.launchpad.net/~ted/dbusmenu/signals-do-crazy-shit/+merge/51246
Fixes a crasher as the variant gets unref'd by the signal handler.
--
https://code.launchpad.net/~ted/dbusmenu/signals-do-crazy-shit/+merge/51246
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
=== modified file 'libdbusmenu-glib/menuitem.c'
--- libdbusmenu-glib/menuitem.c 2011-02-24 20:21:43 +0000
+++ libdbusmenu-glib/menuitem.c 2011-02-25 04:09:53 +0000
@@ -1670,11 +1670,22 @@
#endif
DbusmenuMenuitemClass * class = DBUSMENU_MENUITEM_GET_CLASS(mi);
+ /* We need to keep a ref to the variant because the signal
+ handler will drop the floating ref and then we'll be up
+ a creek if we don't have our own later. */
+ if (variant != NULL) {
+ g_variant_ref_sink(variant);
+ }
+
gboolean handled = FALSE;
g_signal_emit(G_OBJECT(mi), signals[EVENT], g_quark_from_string(name), name, variant, timestamp, &handled);
if (!handled && class->handle_event != NULL) {
- return class->handle_event(mi, name, variant, timestamp);
+ class->handle_event(mi, name, variant, timestamp);
+ }
+
+ if (variant != NULL) {
+ g_variant_unref(variant);
}
return;
Follow ups