summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
diff options
context:
space:
mode:
authorBrandon Scott <xeons@users.noreply.github.com>2019-10-25 00:23:35 -0500
committerAndreas Kling <awesomekling@gmail.com>2019-10-25 15:29:19 +0200
commit51e655f9033d4c14119ab2264735545d3cd85a0a (patch)
treee01a63b430192fc0ddf4d3f1e48e240eef180f4d /Libraries/LibGUI
parent5311f8fae11cbc611abea61fda570a11ce3edee5 (diff)
downloadserenity-51e655f9033d4c14119ab2264735545d3cd85a0a.zip
LibGUI: Added window creation callback to GApplication/GWindow
Added a window creation callback to GApplication that gets called by GWindow which will reset any pending exit request in the CEventLoop. This is to prevent a bug which prevents your application from starting up if you had a message box or other dialog before showing your main application form. The bug was triggered by there being no more visible windows which was triggering a premature quit().
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r--Libraries/LibGUI/GApplication.cpp6
-rw-r--r--Libraries/LibGUI/GApplication.h1
-rw-r--r--Libraries/LibGUI/GWindow.cpp1
3 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibGUI/GApplication.cpp b/Libraries/LibGUI/GApplication.cpp
index ef671eb032..9bdd7af840 100644
--- a/Libraries/LibGUI/GApplication.cpp
+++ b/Libraries/LibGUI/GApplication.cpp
@@ -119,6 +119,12 @@ void GApplication::hide_tooltip()
}
}
+void GApplication::did_create_window(Badge<GWindow>)
+{
+ if (m_event_loop->was_exit_requested())
+ m_event_loop->unquit();
+}
+
void GApplication::did_delete_last_window(Badge<GWindow>)
{
if (m_quit_when_last_window_deleted)
diff --git a/Libraries/LibGUI/GApplication.h b/Libraries/LibGUI/GApplication.h
index 630994561d..ad8e57e76e 100644
--- a/Libraries/LibGUI/GApplication.h
+++ b/Libraries/LibGUI/GApplication.h
@@ -33,6 +33,7 @@ public:
bool quit_when_last_window_deleted() const { return m_quit_when_last_window_deleted; }
void set_quit_when_last_window_deleted(bool b) { m_quit_when_last_window_deleted = b; }
+ void did_create_window(Badge<GWindow>);
void did_delete_last_window(Badge<GWindow>);
const String& invoked_as() const { return m_invoked_as; }
diff --git a/Libraries/LibGUI/GWindow.cpp b/Libraries/LibGUI/GWindow.cpp
index c05f7fe4b4..7620f30acc 100644
--- a/Libraries/LibGUI/GWindow.cpp
+++ b/Libraries/LibGUI/GWindow.cpp
@@ -84,6 +84,7 @@ void GWindow::show()
apply_icon();
reified_windows.set(m_window_id, this);
+ GApplication::the().did_create_window({});
update();
}