mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
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.
This commit is contained in:
parent
338ba238ca
commit
d11d847161
1 changed files with 2 additions and 1 deletions
|
@ -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<const WSMouseEvent&>(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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue