mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
WSMenuManager: Fix set_current_menu() not setting the current menu
m_current_menu was being set and then immediately cleared by close_everyone(). Furthermore, since the menu being set can be a nullptr, we now also make sure to handle that. Finally, the logic can be simplified. close on the current menu is not required, as that is also done by close_everyone().
This commit is contained in:
parent
b37bd28053
commit
2f0eb3e28e
1 changed files with 8 additions and 10 deletions
|
@ -389,18 +389,16 @@ void WSMenuManager::open_menu(WSMenu& menu)
|
||||||
|
|
||||||
void WSMenuManager::set_current_menu(WSMenu* menu, bool is_submenu)
|
void WSMenuManager::set_current_menu(WSMenu* menu, bool is_submenu)
|
||||||
{
|
{
|
||||||
if (!is_submenu && m_current_menu)
|
if (!is_submenu)
|
||||||
m_current_menu->close();
|
|
||||||
if (menu)
|
|
||||||
m_current_menu = menu->make_weak_ptr();
|
|
||||||
|
|
||||||
if (!is_submenu) {
|
|
||||||
close_everyone();
|
close_everyone();
|
||||||
if (menu)
|
|
||||||
m_open_menu_stack.append(menu->make_weak_ptr());
|
if (!menu) {
|
||||||
} else {
|
m_current_menu = nullptr;
|
||||||
m_open_menu_stack.append(menu->make_weak_ptr());
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_open_menu_stack.append(menu->make_weak_ptr());
|
||||||
|
m_current_menu = menu->make_weak_ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSMenuManager::close_bar()
|
void WSMenuManager::close_bar()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue