aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorChris Coulson <chrisccoulson@ubuntu.com>2011-02-24 15:43:25 +0000
committerChris Coulson <chrisccoulson@ubuntu.com>2011-02-24 15:43:25 +0000
commit37fb090b4f9fb1e1a894c5c57e7c3d28eb71f92d (patch)
tree6d1140f1c4f04c82c8d9951151c4eb5dcffce654 /libdbusmenu-gtk
parent5653c7e5642ae25fb54445f749ecfb0c947ead0c (diff)
downloadlibdbusmenu-37fb090b4f9fb1e1a894c5c57e7c3d28eb71f92d.tar.gz
libdbusmenu-37fb090b4f9fb1e1a894c5c57e7c3d28eb71f92d.tar.bz2
libdbusmenu-37fb090b4f9fb1e1a894c5c57e7c3d28eb71f92d.zip
Hold a weak pointer to each DbusmenuMenuitems parent. This avoids
using g_object_{get/set}_data for storing a nodes parent in the parser code, and the associated problems with that (ie, a child out-living its parent, leading to invalid reads
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/parser.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index 09b1e6e..44ea301 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -321,10 +321,6 @@ parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse)
/* Oops, let's tell our parents about us */
if (peek == NULL) {
- /* TODO: Should we set a weak ref on the parent? */
- g_object_set_data (G_OBJECT (thisitem),
- "dbusmenu-parent",
- recurse->parent);
gint pos = get_child_position (widget);
if (pos >= 0)
dbusmenu_menuitem_child_add_position (recurse->parent,
@@ -813,7 +809,7 @@ widget_notify_cb (GtkWidget *widget,
G_CALLBACK (widget_notify_cb),
child);
- DbusmenuMenuitem *parent = g_object_get_data (G_OBJECT (child), "dbusmenu-parent");
+ DbusmenuMenuitem *parent = dbusmenu_menuitem_get_parent (child);
if (DBUSMENU_IS_MENUITEM (parent) && DBUSMENU_IS_MENUITEM (child))
{