summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Window.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-03 19:54:22 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-03 19:56:47 +0100
commit60a245b065e4604e040005a3f9f3a69bf54a6b4e (patch)
treed003217c980580005804f103d18b9e21a3a83470 /Userland/Libraries/LibGUI/Window.cpp
parent24ea6a8ce778babab8f28e8bfe6ce95f2ec1eb6d (diff)
downloadserenity-60a245b065e4604e040005a3f9f3a69bf54a6b4e.zip
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.
Diffstat (limited to 'Userland/Libraries/LibGUI/Window.cpp')
-rw-r--r--Userland/Libraries/LibGUI/Window.cpp6
1 files changed, 6 insertions, 0 deletions
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();