1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:28:11 +00:00

LibGUI: Make GUI::Application a Core::Object

Having this on the stack makes whole-program teardown iffy. Turning it
into a Core::Object allows anyone who needs it to extends its lifetime.
This commit is contained in:
Andreas Kling 2020-07-04 14:05:19 +02:00
parent 0d577ab781
commit 1dd1595043
51 changed files with 140 additions and 138 deletions

View file

@ -49,8 +49,6 @@ Application& Application::the()
Application::Application(int argc, char** argv)
{
(void)argc;
(void)argv;
ASSERT(!s_the);
s_the = this;
m_event_loop = make<Core::EventLoop>();

View file

@ -29,17 +29,19 @@
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
#include <LibCore/Forward.h>
#include <LibCore/Object.h>
#include <LibGUI/Forward.h>
#include <LibGUI/Shortcut.h>
#include <LibGfx/Forward.h>
namespace GUI {
class Application {
class Application : public Core::Object {
C_OBJECT(Application);
public:
static Application& the();
Application(int argc, char** argv);
~Application();
int exec();
@ -71,6 +73,8 @@ public:
bool focus_debugging_enabled() const { return m_focus_debugging_enabled; }
private:
Application(int argc, char** argv);
OwnPtr<Core::EventLoop> m_event_loop;
RefPtr<MenuBar> m_menubar;
RefPtr<Gfx::PaletteImpl> m_palette;