aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-30 13:49:35 -0500
committerTed Gould <ted@gould.cx>2012-03-30 13:49:35 -0500
commit573a0198ca970798e4e66072dde026f801b058af (patch)
treedd91800339d1e985547ada1edc0d8256e42288bf
parentaa9f1edc44962334c34429d7c1fe30da79bcb557 (diff)
downloadlibdbusmenu-573a0198ca970798e4e66072dde026f801b058af.tar.gz
libdbusmenu-573a0198ca970798e4e66072dde026f801b058af.tar.bz2
libdbusmenu-573a0198ca970798e4e66072dde026f801b058af.zip
Splitting out the ending of the event_data object
-rw-r--r--libdbusmenu-glib/client.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index 5492d5b..770bb44 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -1505,6 +1505,22 @@ out:
return;
}
+/* A function to work with an event_data_t and make sure it gets
+ free'd and in a terminal state. */
+static void
+event_data_end (event_data_t * edata, GError * error)
+{
+ g_signal_emit(edata->client, signals[EVENT_RESULT], 0, edata->menuitem, edata->event, edata->variant, edata->timestamp, error, TRUE);
+
+ g_variant_unref(edata->variant);
+ g_free(edata->event);
+ g_object_unref(edata->menuitem);
+ g_object_unref(edata->client);
+ g_free(edata);
+
+ return;
+}
+
/* Respond to the call function to make sure that the other side
got it, or print a warning. */
static void
@@ -1520,13 +1536,7 @@ menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata)
g_warning("Unable to call event '%s' on menu item %d: %s", edata->event, dbusmenu_menuitem_get_id(edata->menuitem), error->message);
}
- g_signal_emit(edata->client, signals[EVENT_RESULT], 0, edata->menuitem, edata->event, edata->variant, edata->timestamp, error, TRUE);
-
- g_variant_unref(edata->variant);
- g_free(edata->event);
- g_object_unref(edata->menuitem);
- g_object_unref(edata->client);
- g_free(edata);
+ event_data_end(edata, error);
if (G_UNLIKELY(error != NULL)) {
g_error_free(error);