summaryrefslogtreecommitdiff
path: root/Servers
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-07-31 10:00:16 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-31 10:23:12 +0200
commiteccc3c3ef0cba7b89da987de33549a5280462142 (patch)
tree3390d0477a00c2fb7bad138abdd8cf43654def8b /Servers
parenta82c60b22a7fb616306f2246f8b7d2e1058ccabc (diff)
downloadserenity-eccc3c3ef0cba7b89da987de33549a5280462142.zip
WindowServer: Control WSClientConnection's window list teardown better
A lot of things happen in response to window destruction, and some of them may call into the window's WSClientConnection and ask it to look through its window list. If we're right in the middle of tearing down the window list, it's not a great idea to start iterating over it. Fixes #386.
Diffstat (limited to 'Servers')
-rw-r--r--Servers/WindowServer/WSClientConnection.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Servers/WindowServer/WSClientConnection.cpp b/Servers/WindowServer/WSClientConnection.cpp
index 1dd139fd5f..6f79207a4e 100644
--- a/Servers/WindowServer/WSClientConnection.cpp
+++ b/Servers/WindowServer/WSClientConnection.cpp
@@ -50,6 +50,10 @@ WSClientConnection::WSClientConnection(CLocalSocket& client_socket, int client_i
WSClientConnection::~WSClientConnection()
{
+ // NOTE: Move the windows out of 'm_windows' before teardown. This prevents code
+ // that runs in response to window destruction from trying to iterate over
+ // a partially destroyed window list.
+ auto windows = move(m_windows);
s_connections->remove(client_id());
}