From d11d8471618dea79142b922d1de6983983af76d1 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Mon, 19 Aug 2019 14:32:18 +0300 Subject: [PATCH] WindowServer: Fix an assertion Now that the window used by a WSMenu is its child CObject, the menu also receives CChildEvent's about the window, including CEvent::ChildAdded when the window gets created. At this point, menu_window() still returns nullptr, so stop unconditionally assuming that it doesn't. We should not care whether or not we have a window for unrelated events anyway. --- Servers/WindowServer/WSMenu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Servers/WindowServer/WSMenu.cpp b/Servers/WindowServer/WSMenu.cpp index 2b435dd8f5..a4c15219f7 100644 --- a/Servers/WindowServer/WSMenu.cpp +++ b/Servers/WindowServer/WSMenu.cpp @@ -157,8 +157,8 @@ void WSMenu::draw() void WSMenu::event(CEvent& event) { - ASSERT(menu_window()); if (event.type() == WSEvent::MouseMove) { + ASSERT(menu_window()); auto* item = item_at(static_cast(event).position()); if (!item || m_hovered_item == item) return; @@ -168,6 +168,7 @@ void WSMenu::event(CEvent& event) } if (event.type() == WSEvent::MouseUp) { + ASSERT(menu_window()); if (!m_hovered_item) return; if (m_hovered_item->is_enabled())