diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c index 8c3de6f32..991613ea3 100644 --- a/src/shell-window-tracker.c +++ b/src/shell-window-tracker.c @@ -631,6 +631,23 @@ on_startup_sequence_changed (MetaStartupNotification *sn, g_signal_emit (G_OBJECT (self), signals[STARTUP_SEQUENCE_CHANGED], 0, sequence); } +static void +on_shutdown (ShellGlobal *shell_global, + ShellWindowTracker *tracker) +{ + g_autoptr (GList) windows; + GList *l; + + windows = g_hash_table_get_keys (tracker->window_to_app); + for (l = windows; l; l = l->next) + { + MetaWindow *window = l->data; + + disassociate_window (tracker, window); + } + g_assert (g_hash_table_size (tracker->window_to_app) == 0); +} + static void shell_window_tracker_init (ShellWindowTracker *self) { @@ -646,6 +663,9 @@ shell_window_tracker_init (ShellWindowTracker *self) load_initial_windows (self); init_window_tracking (self); + + g_signal_connect (shell_global_get (), + "shutdown", G_CALLBACK (on_shutdown), self); } static void