浏览代码

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.
Andreas Kling 5 年之前
父节点
当前提交
7527b9ee72
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      Services/WindowServer/WindowManager.cpp

+ 5 - 4
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>(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);