menuitem: Fix some possible problems with arrow_gadget

https://bugzilla.gnome.org/show_bug.cgi?id=765134 shows
a stacktrace where we end up with arrow_gadget being NULL
despite the conditions for its presence being satisfied.

This commit makes sure we call update_arrow_gadget() whenever
any of the conditions changes. This should fix the reported
crash.
This commit is contained in:
Matthias Clasen 2016-04-17 01:09:32 -04:00
parent 5ba8a25d29
commit 96f0ed9ec5

View File

@ -1528,7 +1528,10 @@ gtk_menu_item_set_submenu (GtkMenuItem *menu_item,
if (priv->submenu != submenu)
{
if (priv->submenu)
gtk_menu_detach (GTK_MENU (priv->submenu));
{
gtk_menu_detach (GTK_MENU (priv->submenu));
priv->submenu = NULL;
}
if (submenu)
{
@ -1536,10 +1539,10 @@ gtk_menu_item_set_submenu (GtkMenuItem *menu_item,
gtk_menu_attach_to_widget (GTK_MENU (submenu),
widget,
gtk_menu_item_detacher);
update_arrow_gadget (menu_item);
}
update_arrow_gadget (menu_item);
if (gtk_widget_get_parent (widget))
gtk_widget_queue_resize (widget);
@ -2348,6 +2351,8 @@ gtk_menu_item_parent_set (GtkWidget *widget,
menu->priv->accel_group,
TRUE);
update_arrow_gadget (menu_item);
if (GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->parent_set)
GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->parent_set (widget, previous_parent);
}