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.
This commit is contained in:
Andreas Kling 2020-07-07 15:37:53 +02:00
parent e0e100f009
commit 7527b9ee72
Notes: sideshowbarker 2024-07-19 05:02:17 +09:00

View file

@ -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>(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);