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.
This commit is contained in:
Timm Bäder 2017-09-26 07:10:39 +02:00
parent 1362609120
commit d54321c1ca

View File

@ -1384,11 +1384,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_display_changed,