mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:07:45 +00:00
WindowServer: Make SetWindowTaskbarRect tolerant to non-existing windows
There is a window between windows disappearing (e.g. closing or crashes) and the Taskbar process being notified. So it is entirely possible that it may call SetWindowTaskbarRect() for a window and/or client id that no longer exists. As the Taskbar process does not own these windows, this should not be treated as a misbehaving application request. Instead, just silently ignore the request. The Taskbar will be notified shortly after that the window no longer exist and remove it from its list. Fixes #3494
This commit is contained in:
parent
961661ea1d
commit
6212f57755
1 changed files with 8 additions and 6 deletions
|
@ -723,16 +723,18 @@ OwnPtr<Messages::WindowServer::GreetResponse> ClientConnection::handle(const Mes
|
||||||
|
|
||||||
void ClientConnection::handle(const Messages::WindowServer::WM_SetWindowTaskbarRect& message)
|
void ClientConnection::handle(const Messages::WindowServer::WM_SetWindowTaskbarRect& message)
|
||||||
{
|
{
|
||||||
|
// Because the Taskbar (which should be the only user of this API) does not own the
|
||||||
|
// window or the client id, there is a possibility that it may send this message for
|
||||||
|
// a window or client that may have been destroyed already. This is not an error,
|
||||||
|
// and we should not call did_misbehave() for either.
|
||||||
auto* client = ClientConnection::from_client_id(message.client_id());
|
auto* client = ClientConnection::from_client_id(message.client_id());
|
||||||
if (!client) {
|
if (!client)
|
||||||
did_misbehave("WM_SetWindowTaskbarRect: Bad client ID");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
auto it = client->m_windows.find(message.window_id());
|
auto it = client->m_windows.find(message.window_id());
|
||||||
if (it == client->m_windows.end()) {
|
if (it == client->m_windows.end())
|
||||||
did_misbehave("WM_SetWindowTaskbarRect: Bad window ID");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
auto& window = *(*it).value;
|
auto& window = *(*it).value;
|
||||||
window.set_taskbar_rect(message.rect());
|
window.set_taskbar_rect(message.rect());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue