diff options
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | libdbusmenu-glib/dbus-menu.xml | 4 | ||||
-rw-r--r-- | libdbusmenu-gtk/parser.c | 64 | ||||
-rw-r--r-- | po/POTFILES.in | 1 |
4 files changed, 45 insertions, 28 deletions
diff --git a/debian/changelog b/debian/changelog index 9d159a7..e335929 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,10 @@ libdbusmenu (0.3.98-0ubuntu2~ppa3) UNRELEASED; urgency=low * Upstream Merge * Add a signal on the menuitem for generic event support + * Memory handling fixes in the parser + * Fix dbus-menu.xml to have more consistent signatures. - -- Ted Gould <ted@ubuntu.com> Wed, 23 Feb 2011 09:46:09 -0600 + -- Ted Gould <ted@ubuntu.com> Wed, 23 Feb 2011 09:48:16 -0600 libdbusmenu (0.3.98-0ubuntu2~ppa2) natty; urgency=low diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 3b42f7d..829c16e 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -326,8 +326,8 @@ License version 3 and version 2.1 along with this program. If not, see the ID of the item with a hashtable of names and values for those properties. </dox:d> - <arg type="a(ia(sv))" name="props" direction="out" /> - <arg type="a(ia(s))" name="props_removed" direction="out" /> + <arg type="a(ia{sv})" name="updatedProps" direction="out" /> + <arg type="a(ias)" name="removedProps" direction="out" /> </signal> <signal name="LayoutUpdated"> <dox:d> diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index f516dde..f2fcb58 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -109,45 +109,58 @@ dbusmenu_gtk_parse_menu_structure (GtkWidget * widget) return recurse.parent; } -/* Called when the dbusmenu item that we're keeping around - is finalized */ static void -dbusmenu_cache_freed (gpointer data, GObject * obj) +parse_data_free (gpointer data) { - /* If the dbusmenu item is killed we don't need to remove - the weak ref as well. */ - g_object_steal_data(G_OBJECT(data), CACHED_MENUITEM); - - ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(obj), PARSER_DATA); + ParserData *pdata = (ParserData *)data; if (pdata != NULL && pdata->label != NULL) { - g_signal_handlers_disconnect_by_func(pdata->label, G_CALLBACK(label_notify_cb), obj); + g_signal_handlers_disconnect_matched(pdata->label, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(label_notify_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->label), (gpointer*)&pdata->label); } if (pdata != NULL && pdata->action != NULL) { - g_signal_handlers_disconnect_by_func(pdata->action, G_CALLBACK(action_notify_cb), obj); + g_signal_handlers_disconnect_matched(pdata->action, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(action_notify_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->action), (gpointer*)&pdata->action); } if (pdata != NULL && pdata->widget != NULL) { - g_signal_handlers_disconnect_by_func(pdata->widget, G_CALLBACK(widget_notify_cb), obj); + g_signal_handlers_disconnect_matched(pdata->widget, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(widget_notify_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->widget), (gpointer*)&pdata->widget); } if (pdata != NULL && pdata->shell != NULL) { - g_signal_handlers_disconnect_by_func(pdata->shell, G_CALLBACK(child_added_cb), obj); + g_signal_handlers_disconnect_matched(pdata->shell, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(child_added_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->shell), (gpointer*)&pdata->shell); } if (pdata != NULL && pdata->image != NULL) { - g_signal_handlers_disconnect_by_func(pdata->image, G_CALLBACK(image_notify_cb), obj); + g_signal_handlers_disconnect_matched(pdata->image, (GSignalMatchType)G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, G_CALLBACK(image_notify_cb), NULL); g_object_remove_weak_pointer(G_OBJECT(pdata->image), (gpointer*)&pdata->image); } + g_free(pdata); + return; } +/* Called when the dbusmenu item that we're keeping around + is finalized */ +static void +dbusmenu_item_freed (gpointer data, GObject * obj) +{ + ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(obj), PARSER_DATA); + + if (pdata != NULL && pdata->widget != NULL) { + g_object_steal_data(G_OBJECT(pdata->widget), CACHED_MENUITEM); + } +} + /* Called if we replace the cache on the object with a new dbusmenu menuitem */ static void @@ -198,10 +211,13 @@ new_menuitem (GtkWidget * widget) DbusmenuMenuitem * item = dbusmenu_menuitem_new(); ParserData *pdata = g_new0 (ParserData, 1); - g_object_set_data_full(G_OBJECT(item), PARSER_DATA, pdata, g_free); + g_object_set_data_full(G_OBJECT(item), PARSER_DATA, pdata, parse_data_free); g_object_set_data_full(G_OBJECT(widget), CACHED_MENUITEM, item, object_cache_freed); - g_object_weak_ref(G_OBJECT(item), dbusmenu_cache_freed, widget); + g_object_weak_ref(G_OBJECT(item), dbusmenu_item_freed, NULL); + + pdata->widget = widget; + g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget); return item; } @@ -237,16 +253,16 @@ parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse) if (recurse->parent == NULL) { recurse->parent = new_menuitem(widget); - } - ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(recurse->parent), PARSER_DATA); + ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(recurse->parent), PARSER_DATA); - pdata->shell = widget; - g_signal_connect (G_OBJECT (widget), - "child-added", - G_CALLBACK (child_added_cb), - recurse->parent); - g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->shell); + pdata->shell = widget; + g_signal_connect (G_OBJECT (widget), + "child-added", + G_CALLBACK (child_added_cb), + recurse->parent); + g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->shell); + } gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback)parse_menu_structure_helper, @@ -472,12 +488,10 @@ construct_dbusmenu_for_widget (GtkWidget * widget) DBUSMENU_MENUITEM_PROP_ENABLED, sensitive); - pdata->widget = widget; g_signal_connect (widget, "notify", G_CALLBACK (widget_notify_cb), mi); - g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget); return mi; } diff --git a/po/POTFILES.in b/po/POTFILES.in index 3536e22..d6ac240 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1 +1,2 @@ +libdbusmenu-glib/defaults.c libdbusmenu-glib/server.c |