shell/window-tracker: Disassociate windows on shutdown

This avoids trying to deal with handling windows being unmanaged one by
one after we destroyed the ShellGlobal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
This commit is contained in:
Jonas Ådahl 2022-11-24 16:27:29 +01:00
parent 210754f1e9
commit 2ca6e2e7e8

View File

@ -631,6 +631,23 @@ on_startup_sequence_changed (MetaStartupNotification *sn,
g_signal_emit (G_OBJECT (self), signals[STARTUP_SEQUENCE_CHANGED], 0, sequence); 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 static void
shell_window_tracker_init (ShellWindowTracker *self) shell_window_tracker_init (ShellWindowTracker *self)
{ {
@ -646,6 +663,9 @@ shell_window_tracker_init (ShellWindowTracker *self)
load_initial_windows (self); load_initial_windows (self);
init_window_tracking (self); init_window_tracking (self);
g_signal_connect (shell_global_get (),
"shutdown", G_CALLBACK (on_shutdown), self);
} }
static void static void