aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/server.c
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2012-02-15 21:38:27 +0100
committerSebastien Bacher <seb128@ubuntu.com>2012-02-15 21:38:27 +0100
commitbe1db87a7e1997e5dd1b69948136c30c7c39d960 (patch)
treef22ea28af5a331799fb6aca0c900a73e9a476720 /libdbusmenu-glib/server.c
parentba23a1f5d6bed315132fb45ff7a63384e2da4e42 (diff)
parent49e45c8b23af0926ec04c50a4ac53068abba21db (diff)
downloadlibdbusmenu-be1db87a7e1997e5dd1b69948136c30c7c39d960.tar.gz
libdbusmenu-be1db87a7e1997e5dd1b69948136c30c7c39d960.tar.bz2
libdbusmenu-be1db87a7e1997e5dd1b69948136c30c7c39d960.zip
* debian/control:
- drop git binaries, the libdev depends on it - set ubuntu vcs - use the current vala version [ Ted Gould ] * New upstream release. * Remove unused const on GStrv's * Only free when there is data to free * Ensure that we only return once even with error (LP: #929856) * Fix an error on a failure to send properties (LP: #929707) * Ensure the hash variant isn't NULL in the comparison (LP: #929710) * Fix some of the issues with throwing criticals * Ensure our tests fail if they throw criticals * Parse and handle a11y descriptions * Don't pass NULL to ATK * Non-srcdir build fixes
Diffstat (limited to 'libdbusmenu-glib/server.c')
-rw-r--r--libdbusmenu-glib/server.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index 4890d37..524e777 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -990,6 +990,7 @@ menuitem_property_idle (gpointer user_data)
/* these are going to be standard references in all code paths and must be unrefed */
GVariant * megadata[2];
gboolean gotsomething = FALSE;
+ gboolean error_nosend = FALSE;
if (item_init) {
megadata[0] = g_variant_builder_end(&itembuilder);
@@ -1002,6 +1003,10 @@ menuitem_property_idle (gpointer user_data)
if (error != NULL) {
g_warning("Unable to parse '[ ]' as a 'a(ia{sv})': %s", error->message);
g_error_free(error);
+ megadata[0] = NULL;
+ error_nosend = TRUE;
+ } else {
+ g_variant_ref_sink(megadata[0]);
}
}
@@ -1016,10 +1021,14 @@ menuitem_property_idle (gpointer user_data)
if (error != NULL) {
g_warning("Unable to parse '[ ]' as a 'a(ias)': %s", error->message);
g_error_free(error);
+ megadata[1] = NULL;
+ error_nosend = TRUE;
+ } else {
+ g_variant_ref_sink(megadata[1]);
}
}
- if (gotsomething && priv->dbusobject != NULL && priv->bus != NULL) {
+ if (gotsomething && !error_nosend && priv->dbusobject != NULL && priv->bus != NULL) {
g_dbus_connection_emit_signal(priv->bus,
NULL,
priv->dbusobject,
@@ -1029,8 +1038,13 @@ menuitem_property_idle (gpointer user_data)
NULL);
}
- g_variant_unref(megadata[0]);
- g_variant_unref(megadata[1]);
+ if (megadata[0] != NULL) {
+ g_variant_unref(megadata[0]);
+ }
+
+ if (megadata[1] != NULL) {
+ g_variant_unref(megadata[1]);
+ }
/* Clean everything up */
prop_array_teardown(priv->prop_array);
@@ -1595,7 +1609,6 @@ bus_event (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * i
DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id);
if (mi == NULL) {
-
g_dbus_method_invocation_return_error(invocation,
error_quark(),
INVALID_MENUITEM_ID,
@@ -1605,17 +1618,17 @@ bus_event (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * i
g_variant_unref(data);
} else {
-
idle_event_t * event_data = g_new0(idle_event_t, 1);
event_data->mi = g_object_ref(mi);
- event_data->eventid = etype;
+ event_data->eventid = etype; /* give away our allocation */
event_data->timestamp = ts;
event_data->variant = data; /* give away our reference */
g_timeout_add(0, event_local_handler, event_data);
+
+ g_dbus_method_invocation_return_value(invocation, NULL);
}
- g_dbus_method_invocation_return_value(invocation, NULL);
return;
}
@@ -1809,7 +1822,7 @@ dbusmenu_server_set_status (DbusmenuServer * server, DbusmenuStatus status)
* memory managed by the server. Duplicate if you want
* to keep them.
*/
-const GStrv
+GStrv
dbusmenu_server_get_icon_paths (DbusmenuServer * server)
{
g_return_val_if_fail(DBUSMENU_IS_SERVER(server), NULL);