From 7527b9ee72075accc40be5acc2af3ddd3fbce250 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 7 Jul 2020 15:37:53 +0200 Subject: [PATCH] WindowServer: set_active_window() should not assume window has a client I saw this assertion fire once and I don't know how I made it happen, but it seems fine for client-less windows to become active, they just don't have a menubar to install. --- Services/WindowServer/WindowManager.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Services/WindowServer/WindowManager.cpp b/Services/WindowServer/WindowManager.cpp index b640510733..c56cdfb467 100644 --- a/Services/WindowServer/WindowManager.cpp +++ b/Services/WindowServer/WindowManager.cpp @@ -1030,10 +1030,11 @@ void WindowManager::set_active_window(Window* window) active_client = m_active_window->client(); Core::EventLoop::current().post_event(*m_active_window, make(Event::WindowActivated)); m_active_window->invalidate(); - - auto* client = window->client(); - ASSERT(client); - MenuManager::the().set_current_menubar(client->app_menubar()); + if (auto* client = window->client()) { + MenuManager::the().set_current_menubar(client->app_menubar()); + } else { + MenuManager::the().set_current_menubar(nullptr); + } tell_wm_listeners_window_state_changed(*m_active_window); } else { MenuManager::the().set_current_menubar(nullptr);