1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

WindowServer: Robustify WSWindow<->WSClientConnection link a bit

WSWindow now detaches from WSClientConnection when being destroyed.

Because of this, we can no longer rely on WSWindow::client() to tell
us whether a window is internal to WindowServer or not. So instead we
now have WSWindow::is_internal() which checks for client_id == -1.

Note that WSWindow now also gets a copy of its client_id when
constructed, since we can no longer rely on client() being valid after
destruction has started.

This allows various automatic mechanisms (e.g what happens in response
to window removal) to skip over windows that are being destroyed.

Fixes #387.
This commit is contained in:
Andreas Kling 2020-01-25 10:25:49 +01:00
parent 60d5b06e21
commit 6df81c8a88
4 changed files with 22 additions and 8 deletions

View file

@ -77,6 +77,8 @@ WSClientConnection::~WSClientConnection()
{
WSMenuManager::the().close_all_menus_from_client({}, *this);
auto windows = move(m_windows);
for (auto& window : windows)
window.value->detach_client({});
}
void WSClientConnection::die()