diff options
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 4 | ||||
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 2 | ||||
-rw-r--r-- | libdbusmenu-glib/server.c | 27 |
3 files changed, 23 insertions, 10 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ff5c51a..e64d923 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -395,7 +395,7 @@ dbusmenu_client_dispose (GObject *object) /* Only used for queueing up a new command, so we can just drop this array. */ - if (priv->delayed_property_list == NULL) { + if (priv->delayed_property_list != NULL) { gchar ** dataregion = (gchar **)g_array_free(priv->delayed_property_list, FALSE); if (dataregion != NULL) { g_strfreev(dataregion); @@ -403,7 +403,7 @@ dbusmenu_client_dispose (GObject *object) priv->delayed_property_list = NULL; } - if (priv->delayed_property_listeners == NULL) { + if (priv->delayed_property_listeners != NULL) { gint i; GError * localerror = NULL; diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 30ae277..18db4ef 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1222,7 +1222,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro but we're actually replacing it no matter. This is so that the variant passed in sticks around which the caller may expect. They shouldn't, but it's low cost to remove bugs. */ - if (!inhash || !g_variant_equal(hash_variant, value)) { + if (!inhash || (hash_variant != NULL && !g_variant_equal(hash_variant, value))) { replaced = TRUE; } diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index a409bd9..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; } |