mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:18:12 +00:00
WindowServer: Remove applets from AppletManager on client disconnection
Disconnecting from WindowServer without explicit calls to DestroyWindow would leave nulled-out WeakPtr's in the AppletManager applet list. This led to a null dereference when adding a new applet, since we were assuming the list contained no nulled-out applets. This patch fixes the issue by always unregistering applet windows from the AppletManager in ~ClientConnection(). We also do an extra pass of pruning any nulled-out WeakPtrs from the applet list when adding to it. Fixes #1551.
This commit is contained in:
parent
c54855682c
commit
c56c8c8953
2 changed files with 9 additions and 1 deletions
|
@ -81,8 +81,11 @@ ClientConnection::~ClientConnection()
|
|||
{
|
||||
MenuManager::the().close_all_menus_from_client({}, *this);
|
||||
auto windows = move(m_windows);
|
||||
for (auto& window : windows)
|
||||
for (auto& window : windows) {
|
||||
window.value->detach_client({});
|
||||
if (window.value->type() == WindowType::MenuApplet)
|
||||
AppletManager::the().remove_applet(window.value);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientConnection::die()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue