diff options
-rw-r--r-- | debian/changelog | 12 | ||||
-rw-r--r-- | libdbusmenu-gtk/client.c | 18 | ||||
-rw-r--r-- | libdbusmenu-gtk/genericmenuitem.c | 1 |
3 files changed, 26 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog index 70d858f..b270830 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +libdbusmenu (0.5.0-0ubuntu3) oneiric; urgency=low + + * libdbusmenu-gtk/client.c: + - Make sure to actually free memory associated with GtkMenuItems we + create. We are holding the sunk floating ref, so we have to + actually unref as well as destroy the widget. Part of bug 835646. + * libdbusmenu-gtk/genericmenuitem.c: + - When setting an image on a menu item for the second time before + setting a label, don't try to use free'd memory. + + -- Michael Terry <mterry@ubuntu.com> Thu, 06 Oct 2011 10:35:21 -0400 + libdbusmenu (0.5.0-0ubuntu2) oneiric; urgency=low * libdbusmenu-glib/client.c diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 1051f20..38b6a75 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -823,14 +823,22 @@ item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint timestamp, return; } -#ifdef MASSIVEDEBUGGING static void -destroy_gmi (GtkMenuItem * gmi, DbusmenuMenuitem * mi) +destroy_gmi (GtkMenuItem * gmi) { - g_debug("Destorying GTK Menuitem for %d", dbusmenu_menuitem_get_id(mi)); +#ifdef MASSIVEDEBUGGING + g_debug("Destroying GTK Menuitem %d", gmi); +#endif + + /* Call gtk_widget_destroy to remove from any containers and cleanup */ + gtk_widget_destroy(GTK_WIDGET(gmi)); + + /* Now remove last ref that we are holding (due to g_object_ref_sink in + dbusmenu_gtkclient_newitem_base). This should finalize the object */ + g_object_unref(G_OBJECT(gmi)); + return; } -#endif /** * dbusmenu_gtkclient_newitem_base: @@ -857,7 +865,7 @@ dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * /* Attach these two */ g_object_ref_sink(G_OBJECT(gmi)); - g_object_set_data_full(G_OBJECT(item), data_menuitem, gmi, (GDestroyNotify)gtk_widget_destroy); + g_object_set_data_full(G_OBJECT(item), data_menuitem, gmi, (GDestroyNotify)destroy_gmi); /* DbusmenuMenuitem signals */ g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menu_prop_change_cb), client); diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c index 5488f93..ef77a2e 100644 --- a/libdbusmenu-gtk/genericmenuitem.c +++ b/libdbusmenu-gtk/genericmenuitem.c @@ -449,6 +449,7 @@ genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image) if (GTK_IS_IMAGE(child)) { /* We've got a label, let's update it. */ imagew = GTK_IMAGE(child); + child = NULL; } else if (GTK_IS_BOX(child)) { /* Look for the label in the box */ gtk_container_foreach(GTK_CONTAINER(child), set_image_helper, &imagew); |