summaryrefslogtreecommitdiff
path: root/gtk2_ardour/splash.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-05-11 14:20:33 +0200
committerRobin Gareus <robin@gareus.org>2017-05-11 14:20:56 +0200
commit24d5f1a6249b08a8b21854ecf001be7e07e5bf23 (patch)
tree0ea92155b52b4a2f93786e5b2064d11f63dab335 /gtk2_ardour/splash.cc
parent26593d08ed34402c05b712f43ca3918d061a8ccd (diff)
Tweak/fix splash screen event-loop
Prevent possible endless loop in Splash::display() and handle some related edge-cases and race conditions WRT expose_done and is_visible().
Diffstat (limited to 'gtk2_ardour/splash.cc')
-rw-r--r--gtk2_ardour/splash.cc28
1 files changed, 21 insertions, 7 deletions
diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc
index 744a49fa4f..756749c6e6 100644
--- a/gtk2_ardour/splash.cc
+++ b/gtk2_ardour/splash.cc
@@ -21,6 +21,7 @@
#include "pbd/failed_constructor.h"
#include "pbd/file_utils.h"
+#include "pbd/stacktrace.h"
#include "ardour/ardour.h"
#include "ardour/filesystem_paths.h"
@@ -99,6 +100,9 @@ Splash::Splash ()
Splash::~Splash ()
{
+ idle_connection.disconnect ();
+ expose_done = true;
+ hide ();
the_splash = 0;
}
@@ -129,11 +133,19 @@ Splash::pop_back_for (Gtk::Window& win)
void
Splash::pop_front ()
{
-#if defined __APPLE__ || defined PLATFORM_WINDOWS
if (get_window()) {
+#if defined __APPLE__ || defined PLATFORM_WINDOWS
show ();
- }
+#else
+ gdk_window_restack(get_window()->gobj(), NULL, true);
#endif
+ }
+}
+
+void
+Splash::hide ()
+{
+ Gtk::Window::hide();
}
void
@@ -182,8 +194,9 @@ Splash::expose (GdkEventExpose* ev)
*/
if (expose_is_the_one) {
- Glib::signal_idle().connect (sigc::mem_fun (this, &Splash::idle_after_expose),
- GDK_PRIORITY_REDRAW+2);
+ idle_connection = Glib::signal_idle().connect (
+ sigc::mem_fun (this, &Splash::idle_after_expose),
+ GDK_PRIORITY_REDRAW+2);
}
return true;
@@ -216,7 +229,7 @@ Splash::display ()
present ();
if (!was_mapped) {
- while (!expose_done) {
+ while (!expose_done && gtk_events_pending()) {
gtk_main_iteration ();
}
gdk_display_flush (gdk_display_get_default());
@@ -236,13 +249,14 @@ Splash::message (const string& msg)
Glib::RefPtr<Gdk::Window> win = darea.get_window();
if (win) {
- expose_done = false;
-
if (win->is_visible ()) {
win->invalidate_rect (Gdk::Rectangle (0, darea.get_height() - 30, darea.get_width(), 30), true);
} else {
darea.queue_draw ();
}
+ if (expose_done) {
+ ARDOUR::GUIIdle ();
+ }
}
}