mirror of
https://github.com/RGBCube/serenity
synced 2025-06-16 18:42:07 +00:00
WindowServer: Close all menus belonging to a client when it disconnects
Previously we would be left with a menu stack containing nulled-out WeakPtr's to menus in the now-disconnected clients. This was tripping up an assertion when clicking anywhere after shutting down a program while it had a menu open.
This commit is contained in:
parent
9fe316c2d8
commit
0ac95ec510
3 changed files with 12 additions and 0 deletions
|
@ -49,6 +49,7 @@ WSClientConnection::WSClientConnection(CLocalSocket& client_socket, int client_i
|
|||
|
||||
WSClientConnection::~WSClientConnection()
|
||||
{
|
||||
WSWindowManager::the().menu_manager().close_all_menus_from_client({}, *this);
|
||||
auto windows = move(m_windows);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,6 +171,15 @@ void WSMenuManager::set_needs_window_resize()
|
|||
m_needs_window_resize = true;
|
||||
}
|
||||
|
||||
void WSMenuManager::close_all_menus_from_client(Badge<WSClientConnection>, WSClientConnection & client)
|
||||
{
|
||||
if (m_open_menu_stack.is_empty())
|
||||
return;
|
||||
if (m_open_menu_stack.first()->client() != &client)
|
||||
return;
|
||||
close_everyone();
|
||||
}
|
||||
|
||||
void WSMenuManager::close_everyone()
|
||||
{
|
||||
for (auto& menu : m_open_menu_stack) {
|
||||
|
|
|
@ -34,6 +34,8 @@ public:
|
|||
void close_everyone_not_in_lineage(WSMenu&);
|
||||
void close_menu_and_descendants(WSMenu&);
|
||||
|
||||
void close_all_menus_from_client(Badge<WSClientConnection>, WSClientConnection&);
|
||||
|
||||
void add_applet(WSWindow&);
|
||||
void remove_applet(WSWindow&);
|
||||
void invalidate_applet(const WSWindow&, const Rect&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue