diff options
-rw-r--r-- | libdbusmenu-glib/client.c | 6 | ||||
-rw-r--r-- | libdbusmenu-glib/client.h | 2 | ||||
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 2 | ||||
-rw-r--r-- | libdbusmenu-glib/server.c | 29 | ||||
-rw-r--r-- | libdbusmenu-glib/server.h | 2 | ||||
-rw-r--r-- | libdbusmenu-gtk/client.c | 7 | ||||
-rw-r--r-- | libdbusmenu-gtk/parser.c | 9 | ||||
-rw-r--r-- | tests/Makefile.am | 33 |
8 files changed, 68 insertions, 22 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index a2330d1..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; @@ -2210,7 +2210,7 @@ dbusmenu_client_get_status (DbusmenuClient * client) * memory managed by the client. Duplicate if you want * to keep them. */ -const GStrv +GStrv dbusmenu_client_get_icon_paths (DbusmenuClient * client) { g_return_val_if_fail(DBUSMENU_IS_CLIENT(client), NULL); diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 1cb9ee5..d0fca32 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -212,7 +212,7 @@ gboolean dbusmenu_client_add_type_handler_full (DbusmenuClient * cli GDestroyNotify destroy_func); DbusmenuTextDirection dbusmenu_client_get_text_direction (DbusmenuClient * client); DbusmenuStatus dbusmenu_client_get_status (DbusmenuClient * client); -const GStrv dbusmenu_client_get_icon_paths (DbusmenuClient * client); +GStrv dbusmenu_client_get_icon_paths (DbusmenuClient * client); /** SECTION:client 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 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); diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index 5feb09b..d482a10 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -167,7 +167,7 @@ void dbusmenu_server_set_text_direction (DbusmenuServer * DbusmenuStatus dbusmenu_server_get_status (DbusmenuServer * server); void dbusmenu_server_set_status (DbusmenuServer * server, DbusmenuStatus status); -const GStrv dbusmenu_server_get_icon_paths (DbusmenuServer * server); +GStrv dbusmenu_server_get_icon_paths (DbusmenuServer * server); void dbusmenu_server_set_icon_paths (DbusmenuServer * server, GStrv icon_paths); diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 30ded29..830356a 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -1152,12 +1152,7 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, GVariant return; } - const gchar * value = NULL; - if (variant != NULL) { - value = g_variant_get_string(variant, NULL); - } - - if (value == NULL || value[0] == '\0') { + if (variant == NULL) { /* This means that we're unsetting a value. */ /* Try to use the other one */ if (g_strcmp0(property, DBUSMENU_MENUITEM_PROP_ICON_NAME)) { diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index efa8485..019a304 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -427,8 +427,11 @@ parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse) /* Oops, let's tell our parents about us */ if (peek == NULL) { - if (dbusmenu_menuitem_get_parent(thisitem) != NULL) { - dbusmenu_menuitem_unparent(thisitem); + g_object_ref(thisitem); + + DbusmenuMenuitem * parent = dbusmenu_menuitem_get_parent(thisitem); + if (parent != NULL) { + dbusmenu_menuitem_child_delete(parent, thisitem); } gint pos = get_child_position (widget); @@ -439,6 +442,8 @@ parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse) else dbusmenu_menuitem_child_append (recurse->parent, thisitem); + + g_object_unref(thisitem); } } diff --git a/tests/Makefile.am b/tests/Makefile.am index 532c14f..db2d469 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -135,6 +135,8 @@ glib_server_nomenu_LDADD = \ test-glib-layout: test-glib-layout-client test-glib-layout-server Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-layout-client --task-name Client --task ./test-glib-layout-server --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -168,6 +170,8 @@ test_glib_layout_client_LDADD = \ test-glib-events: test-glib-events-client test-glib-events-server Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-events-client --task-name Client --task ./test-glib-events-server --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -199,6 +203,8 @@ test_glib_events_client_LDADD = \ test-json: test-json-client test-json-server Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task ./test-json-client --task-name Client --parameter $(top_builddir)/tools/dbusmenu-dumper --parameter test-json-01.output.json --ignore-return --task ./test-json-server --task-name Server --parameter $(srcdir)/test-json-01.json --ignore-return >> $@ @echo diff $(srcdir)/test-json-01.json test-json-01.output.json \> /dev/null >> $@ @@ -240,6 +246,11 @@ test_json_client_LDADD = \ test-glib-submenu: test-glib-submenu-client test-glib-submenu-server Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ +# Removing the check for criticals here as there's one coming from GTK +# in the grabbing code on GTK3. Since we can't add events to the stack +# we can't remove this error from getting thrown :-( +# @echo export G_DEBUG=fatal_criticals >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-submenu-client --task-name Client --task ./test-glib-submenu-server --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -275,6 +286,8 @@ OBJECT_XML_REPORT = test-glib-objects.xml test-glib-objects-test: test-glib-objects Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(DBUS_RUNNER) --task gtester --task-name test --parameter --verbose --parameter -k --parameter -o --parameter $(OBJECT_XML_REPORT) --parameter ./test-glib-objects >> $@ @chmod +x $@ @@ -297,6 +310,8 @@ DISTCLEANFILES += $(OBJECT_XML_REPORT) test-glib-properties: test-glib-properties-client test-glib-properties-server Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-properties-client --task-name Client --task ./test-glib-properties-server --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -330,6 +345,8 @@ test_glib_properties_client_LDADD = \ test-glib-proxy: test-glib-proxy-client test-glib-proxy-server test-glib-proxy-proxy Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-proxy-client --task-name Client --task ./test-glib-proxy-server --task-name Server --ignore-return \\ >> $@ @echo --task ./test-glib-proxy-proxy --parameter test.proxy.first_proxy --parameter test.proxy.second_proxy --task-name Proxy01 --ignore-return \\ >> $@ @echo --task ./test-glib-proxy-proxy --parameter test.proxy.second_proxy --parameter test.proxy.third_proxy --task-name Proxy02 --ignore-return \\ >> $@ @@ -399,6 +416,8 @@ GTK_OBJECT_XML_REPORT = test-gtk-objects.xml test-gtk-objects-test: test-gtk-objects Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task gtester --task-name test --parameter --verbose --parameter -k --parameter -o --parameter $(GTK_OBJECT_XML_REPORT) --parameter ./test-gtk-objects >> $@ @chmod +x $@ @@ -429,6 +448,8 @@ GTK_PARSER_XML_REPORT = test-gtk-parser.xml test-gtk-parser-test: test-gtk-parser Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(XVFB_RUN) >> $@ @echo gtester --verbose -k -o $(GTK_PARSER_XML_REPORT) ./test-gtk-parser >> $@ @chmod +x $@ @@ -457,6 +478,8 @@ DISTCLEANFILES += $(GTK_PARSER_XML_REPORT) test-gtk-label: test-gtk-label-client test-gtk-label-server test-gtk-label.json Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task ./test-gtk-label-client --task-name Client --task ./test-gtk-label-server --parameter $(srcdir)/test-gtk-label.json --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -498,6 +521,8 @@ test_gtk_label_client_LDADD = \ test-gtk-shortcut: test-gtk-shortcut-client test-gtk-shortcut-server Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -538,6 +563,8 @@ test_gtk_shortcut_client_LDADD = \ test-gtk-shortcut-python: test-gtk-shortcut-server test-gtk-shortcut-client.py Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task $(srcdir)/test-gtk-shortcut-client.py --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -551,6 +578,8 @@ CLEANFILES += test-gtk-shortcut-client.pyc test-gtk-reorder: test-gtk-label-client test-gtk-reorder-server Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task ./test-gtk-label-client --task-name Client --task ./test-gtk-reorder-server --parameter $(srcdir)/test-gtk-label.json --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -576,6 +605,8 @@ test_gtk_reorder_server_LDADD = \ test-gtk-submenu: test-gtk-submenu-client test-gtk-submenu-server Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task ./test-gtk-submenu-client --task-name Client --task ./test-gtk-submenu-server --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -616,6 +647,8 @@ test_gtk_submenu_client_LDADD = \ test-mago: test-gtk-label-client test-gtk-label-server $(srcdir)/dbusmenu-gtk/mago_tests/dbusmenu.xml Makefile.am @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ @echo $(XVFB_RUN) >> $@ @echo cd $(srcdir)/dbusmenu-gtk >> $@ @echo /usr/lib/at-spi/at-spi-registryd \& >> $@ |