mirror of
https://github.com/RGBCube/serenity
synced 2025-06-15 07:52:06 +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)
|
||||
{
|
||||
if (!is_submenu && m_current_menu)
|
||||
m_current_menu->close();
|
||||
if (menu)
|
||||
m_current_menu = menu->make_weak_ptr();
|
||||
|
||||
if (!is_submenu) {
|
||||
if (!is_submenu)
|
||||
close_everyone();
|
||||
if (menu)
|
||||
m_open_menu_stack.append(menu->make_weak_ptr());
|
||||
} else {
|
||||
m_open_menu_stack.append(menu->make_weak_ptr());
|
||||
|
||||
if (!menu) {
|
||||
m_current_menu = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
m_open_menu_stack.append(menu->make_weak_ptr());
|
||||
m_current_menu = menu->make_weak_ptr();
|
||||
}
|
||||
|
||||
void WSMenuManager::close_bar()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue