Commit 136b8853 authored by Timm Bäder's avatar Timm Bäder 👎

menu: Guard against NULL toplevel

This can happen, as indicated by GtkMenu explicitly connecting to
::destroy of its toplevel window. Do the same thing in GtkComboBox.
parent 4c8f7c4a
......@@ -1790,12 +1790,15 @@ gtk_combo_box_detacher (GtkWidget *widget,
g_return_if_fail (priv->popup_widget == (GtkWidget *) menu);
g_signal_handlers_disconnect_by_func (menu->priv->toplevel,
gtk_combo_box_menu_show,
combo_box);
g_signal_handlers_disconnect_by_func (menu->priv->toplevel,
gtk_combo_box_menu_hide,
combo_box);
if (menu->priv->toplevel)
{
g_signal_handlers_disconnect_by_func (menu->priv->toplevel,
gtk_combo_box_menu_show,
combo_box);
g_signal_handlers_disconnect_by_func (menu->priv->toplevel,
gtk_combo_box_menu_hide,
combo_box);
}
priv->popup_widget = NULL;
}
......
......@@ -1625,11 +1625,14 @@ gtk_menu_detach (GtkMenu *menu)
g_object_set_data (G_OBJECT (menu), I_(attach_data_key), NULL);
/* Detach the toplevel window. */
g_signal_handlers_disconnect_by_func (toplevel,
(gpointer) menu_toplevel_attached_to,
menu);
if (gtk_window_get_attached_to (toplevel) == data->attach_widget)
gtk_window_set_attached_to (toplevel, NULL);
if (toplevel)
{
g_signal_handlers_disconnect_by_func (toplevel,
(gpointer) menu_toplevel_attached_to,
menu);
if (gtk_window_get_attached_to (toplevel) == data->attach_widget)
gtk_window_set_attached_to (toplevel, NULL);
}
g_signal_handlers_disconnect_by_func (data->attach_widget,
(gpointer) attach_widget_screen_changed,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment