ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #03222
[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 240: Fixing to ensure we keep a variant reference.
Merge authors:
Ted Gould (ted)
Related merge proposals:
https://code.launchpad.net/~ted/dbusmenu/signals-do-crazy-shit/+merge/51246
proposed by: Ted Gould (ted)
review: Approve - Mikkel Kamstrup Erlandsen (kamstrup)
------------------------------------------------------------
revno: 240 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Sat 2011-02-26 14:08:34 -0600
message:
Fixing to ensure we keep a variant reference.
modified:
libdbusmenu-glib/menuitem.c
--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== modified file 'libdbusmenu-glib/menuitem.c'
--- libdbusmenu-glib/menuitem.c 2011-02-24 20:21:43 +0000
+++ libdbusmenu-glib/menuitem.c 2011-02-25 03:30:16 +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;