1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

WindowServer: Clean up any menu objects on process exit.

..and now that this works, implement the Quit menu action in Terminal. :^)
This commit is contained in:
Andreas Kling 2019-02-12 10:41:09 +01:00
parent f311d0f353
commit 4b8133e925
10 changed files with 76 additions and 16 deletions

View file

@ -257,6 +257,13 @@ int Process::gui$set_global_cursor_tracking_enabled(int window_id, bool enabled)
return 0;
}
void Process::destroy_all_menus()
{
if (!m_has_created_menus)
return;
WSWindowManager::the().destroy_all_menus(*this);
}
void Process::destroy_all_windows()
{
for (auto& it : m_windows) {
@ -267,7 +274,6 @@ void Process::destroy_all_windows()
m_windows.clear();
}
DisplayInfo Process::set_video_resolution(int width, int height)
{
DisplayInfo info;
@ -288,6 +294,7 @@ DisplayInfo Process::set_video_resolution(int width, int height)
int Process::gui$menubar_create()
{
m_has_created_menus = true;
return WSWindowManager::the().api$menubar_create();
}
@ -305,6 +312,7 @@ int Process::gui$menu_create(const char* name)
{
if (!validate_read_str(name))
return -EFAULT;
m_has_created_menus = true;
return WSWindowManager::the().api$menu_create(String(name));
}