application: Be save against impl being NULL

We clear the impl in shutdown, so all callbacks that may
happen at a later time need to be prepared for this.

https://bugzilla.gnome.org/show_bug.cgi?id=755432
This commit is contained in:
Matthias Clasen 2015-09-23 14:35:58 -04:00
parent 1374645089
commit aff6835f1b

View File

@ -723,7 +723,8 @@ gtk_application_window_removed (GtkApplication *application,
old_active = priv->windows; old_active = priv->windows;
gtk_application_impl_window_removed (application->priv->impl, window); if (priv->impl)
gtk_application_impl_window_removed (priv->impl, window);
g_signal_handlers_disconnect_by_func (window, g_signal_handlers_disconnect_by_func (window,
gtk_application_focus_in_event_cb, gtk_application_focus_in_event_cb,
@ -733,9 +734,9 @@ gtk_application_window_removed (GtkApplication *application,
priv->windows = g_list_remove (priv->windows, window); priv->windows = g_list_remove (priv->windows, window);
gtk_window_set_application (window, NULL); gtk_window_set_application (window, NULL);
if (priv->windows != old_active) if (priv->windows != old_active && priv->impl)
{ {
gtk_application_impl_active_window_changed (application->priv->impl, priv->windows ? priv->windows->data : NULL); gtk_application_impl_active_window_changed (priv->impl, priv->windows ? priv->windows->data : NULL);
g_object_notify_by_pspec (G_OBJECT (application), gtk_application_props[PROP_ACTIVE_WINDOW]); g_object_notify_by_pspec (G_OBJECT (application), gtk_application_props[PROP_ACTIVE_WINDOW]);
} }
} }