mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
WindowServer: Don't try to flash menubar in deleted windows
Capture the window weakly when setting up the menubar flash timer.
This commit is contained in:
parent
c53486b9ce
commit
611733af0d
1 changed files with 5 additions and 3 deletions
|
@ -216,9 +216,11 @@ void ClientConnection::flash_menubar_menu(i32 window_id, i32 menu_id)
|
||||||
m_flashed_menu_timer->stop();
|
m_flashed_menu_timer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_flashed_menu_timer = Core::Timer::create_single_shot(75, [&window] {
|
m_flashed_menu_timer = Core::Timer::create_single_shot(75, [weak_window = window.make_weak_ptr<Window>()]() mutable {
|
||||||
window.menubar().flash_menu(nullptr);
|
if (!weak_window)
|
||||||
window.frame().invalidate_menubar();
|
return;
|
||||||
|
weak_window->menubar().flash_menu(nullptr);
|
||||||
|
weak_window->frame().invalidate_menubar();
|
||||||
});
|
});
|
||||||
m_flashed_menu_timer->start();
|
m_flashed_menu_timer->start();
|
||||||
} else if (m_flashed_menu_timer) {
|
} else if (m_flashed_menu_timer) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue