aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-01-31 12:08:57 -0600
committerTed Gould <ted@gould.cx>2011-01-31 12:08:57 -0600
commit74a0afebe8d3c1fa28d969739ea5c718f00e8c0d (patch)
treea9ba7c6d8592eec74842f1d1a433081385dcbc6f
parent591583b6e602b93399fd125da1f658146e5d717d (diff)
downloadlibdbusmenu-74a0afebe8d3c1fa28d969739ea5c718f00e8c0d.tar.gz
libdbusmenu-74a0afebe8d3c1fa28d969739ea5c718f00e8c0d.tar.bz2
libdbusmenu-74a0afebe8d3c1fa28d969739ea5c718f00e8c0d.zip
Handle the case where we don't have a cached item. Not sure how that'd be, but we shouldn't let it drop.
-rw-r--r--libdbusmenu-gtk/parser.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index 4941bf4..7e5e7e1 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -666,11 +666,19 @@ widget_notify_cb (GtkWidget *widget,
}
/* Now parse new submenu. */
- GtkWidget * menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
RecurseContext recurse = {0};
recurse.toplevel = gtk_widget_get_toplevel(widget);
recurse.parent = item;
- parse_menu_structure_helper(menu, &recurse);
+
+ if (item != NULL) {
+ GtkWidget * menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
+ parse_menu_structure_helper(menu, &recurse);
+ } else {
+ /* Note: it would be really odd that we wouldn't have a cached
+ item, but we should handle that appropriately. */
+ parse_menu_structure_helper(widget, &recurse);
+ g_object_unref(G_OBJECT(recurse.parent));
+ }
}
}