aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-30 10:34:16 -0500
committerTed Gould <ted@gould.cx>2012-03-30 10:34:16 -0500
commit2d42ea2907a69630d5d7d6af242914a595727b86 (patch)
tree82fa7c1676c390252149e418ee6ce18a8739e14c /libdbusmenu-glib
parent37c153112c49f04f44cf1781ee49d369ac3ea84c (diff)
downloadlibdbusmenu-2d42ea2907a69630d5d7d6af242914a595727b86.tar.gz
libdbusmenu-2d42ea2907a69630d5d7d6af242914a595727b86.tar.bz2
libdbusmenu-2d42ea2907a69630d5d7d6af242914a595727b86.zip
Make it so the memory handling of the event_core function is more predictable and correct.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/server.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index ab1e0bc..39641a5 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -1660,9 +1660,9 @@ bus_event_core (DbusmenuServer * server, gint32 id, gchar * event_type, GVariant
idle_event_t * event_data = g_new0(idle_event_t, 1);
event_data->mi = g_object_ref(mi);
- event_data->eventid = event_type; /* give away our allocation */
+ event_data->eventid = g_strdup(event_type);
event_data->timestamp = timestamp;
- event_data->variant = data; /* give away our reference */
+ event_data->variant = g_variant_ref(data);
g_timeout_add(0, event_local_handler, event_data);
@@ -1696,14 +1696,15 @@ bus_event (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * i
INVALID_MENUITEM_ID,
"The ID supplied %d does not refer to a menu item we have",
id);
- g_free(etype);
- g_variant_unref(data);
} else {
if (~g_dbus_message_get_flags (g_dbus_method_invocation_get_message (invocation)) & G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED) {
g_dbus_method_invocation_return_value(invocation, NULL);
}
}
+ g_free(etype);
+ g_variant_unref(data);
+
return;
}