mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +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:
parent
f311d0f353
commit
4b8133e925
10 changed files with 76 additions and 16 deletions
|
@ -2133,6 +2133,7 @@ void Process::finalize()
|
|||
{
|
||||
ASSERT(current == g_finalizer);
|
||||
|
||||
destroy_all_menus();
|
||||
destroy_all_windows();
|
||||
m_fds.clear();
|
||||
m_tty = nullptr;
|
||||
|
|
|
@ -244,6 +244,7 @@ public:
|
|||
static void initialize();
|
||||
static void initialize_gui_statics();
|
||||
int make_window_id();
|
||||
void destroy_all_menus();
|
||||
void destroy_all_windows();
|
||||
|
||||
void crash() NORETURN;
|
||||
|
@ -419,6 +420,7 @@ private:
|
|||
Vector<GUI_Event> m_gui_events;
|
||||
Lock m_gui_events_lock;
|
||||
int m_next_window_id { 1 };
|
||||
bool m_has_created_menus { false };
|
||||
|
||||
dword m_wakeup_requested { false };
|
||||
bool m_has_used_fpu { false };
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue