mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03: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
Notes:
sideshowbarker
2024-07-19 10:11:05 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/2f0eb3e28e6 Pull-request: https://github.com/SerenityOS/serenity/pull/1047
@ -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…
Reference in New Issue
Block a user