From 095b84080acb22f5c9db5391b0edd498af8c2262 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 12 Dec 2022 10:15:55 -0700 Subject: [PATCH] ArdourDialog: API to prevent idle callbacks during response handling --- gtk2_ardour/ardour_dialog.cc | 10 +++++++++- gtk2_ardour/ardour_dialog.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc index c68f2bec16..f458abf644 100644 --- a/gtk2_ardour/ardour_dialog.cc +++ b/gtk2_ardour/ardour_dialog.cc @@ -42,6 +42,7 @@ ArdourDialog::ArdourDialog (const string& title, bool modal, bool use_seperator) , _sensitive (true) , proxy (nullptr) , _splash_pushed (false) + , allow_idle (true) { init (); set_position (Gtk::WIN_POS_MOUSE); @@ -52,6 +53,7 @@ ArdourDialog::ArdourDialog (Gtk::Window& parent, const string& title, bool modal , _sensitive (true) , proxy (nullptr) , _splash_pushed (false) + , allow_idle (true) { init (); set_position (Gtk::WIN_POS_CENTER_ON_PARENT); @@ -63,6 +65,10 @@ ArdourDialog::~ArdourDialog () Keyboard::the_keyboard ().focus_out_window (nullptr, this); WM::Manager::instance ().remove (proxy); proxy->explicit_delete (); +void +ArdourDialog::disallow_idle () +{ + allow_idle = false; } void @@ -70,7 +76,9 @@ ArdourDialog::on_response (int response_id) { pop_splash (); hide (); - ARDOUR::GUIIdle (); + if (allow_idle) { + ARDOUR::GUIIdle (); + } Gtk::Dialog::on_response (response_id); } diff --git a/gtk2_ardour/ardour_dialog.h b/gtk2_ardour/ardour_dialog.h index 7f34ba98dd..e3bf268176 100644 --- a/gtk2_ardour/ardour_dialog.h +++ b/gtk2_ardour/ardour_dialog.h @@ -51,6 +51,7 @@ public: void on_show (); virtual void on_response (int); void set_ui_sensitive (bool); + void disallow_idle (); protected: void pop_splash (); @@ -61,6 +62,7 @@ private: WM::ProxyTemporary* proxy; bool _splash_pushed; void init (); + bool allow_idle; static sigc::signal CloseAllDialogs; };