From 60a245b065e4604e040005a3f9f3a69bf54a6b4e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 3 Nov 2021 19:54:22 +0100 Subject: [PATCH] LibGUI: Don't ask WindowServer to destroy windows during app teardown This makes teardown faster since we don't have to wait for responses to each destroy_window request. It also avoids doing IPC during teardown, which is a general source of problems. --- Userland/Libraries/LibGUI/Window.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index 6f7265f3ac..67a5d0dd7b 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -198,6 +198,12 @@ void Window::hide() { if (!is_visible()) return; + + // NOTE: Don't bother asking WindowServer to destroy windows during application teardown. + // All our windows will be automatically garbage-collected by WindowServer anyway. + if (GUI::Application::in_teardown()) + return; + auto destroyed_window_ids = WindowServerConnection::the().destroy_window(m_window_id); server_did_destroy();