diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-03 19:53:33 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-03 19:56:47 +0100 |
commit | 24ea6a8ce778babab8f28e8bfe6ce95f2ec1eb6d (patch) | |
tree | c4bd03235113e65f0bcea7f9316107c6070ee6f9 /Userland/Libraries/LibGUI | |
parent | d1a5254e416e56be89a27ce5da9097deb4ab5e02 (diff) | |
download | serenity-24ea6a8ce778babab8f28e8bfe6ce95f2ec1eb6d.zip |
LibGUI: Add GUI::Application::in_teardown()
This will return true after ~GUI::Application() has been entered.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/Application.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Application.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index 58e80f2390..5b5b7554a6 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -101,8 +101,16 @@ Application::Application(int argc, char** argv, Core::EventLoop::MakeInspectable }); } +static bool s_in_teardown; + +bool Application::in_teardown() +{ + return s_in_teardown; +} + Application::~Application() { + s_in_teardown = true; revoke_weak_ptrs(); } diff --git a/Userland/Libraries/LibGUI/Application.h b/Userland/Libraries/LibGUI/Application.h index 8847c35ae5..31c4a421a9 100644 --- a/Userland/Libraries/LibGUI/Application.h +++ b/Userland/Libraries/LibGUI/Application.h @@ -27,6 +27,8 @@ public: ~Application(); + static bool in_teardown(); + int exec(); void quit(int = 0); |