aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-02-26 14:08:34 -0600
committerTed Gould <ted@gould.cx>2011-02-26 14:08:34 -0600
commit218b2b32a73881b198f09f74725d395d2d27acdc (patch)
treee9a88544d27837274f923956f9f498b38751f536 /libdbusmenu-glib
parentf5ef3600b66047f13796972ee40acf7b50b81790 (diff)
parent86bd1a4d6b7f9eb47357dae9569d150e5be4b338 (diff)
downloadlibdbusmenu-218b2b32a73881b198f09f74725d395d2d27acdc.tar.gz
libdbusmenu-218b2b32a73881b198f09f74725d395d2d27acdc.tar.bz2
libdbusmenu-218b2b32a73881b198f09f74725d395d2d27acdc.zip
Fixing to ensure we keep a variant reference.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/menuitem.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index 5202aa1..34147a3 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -1670,11 +1670,22 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVari
#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;