Delete temporary Window Proxy for dialogs
authorRobin Gareus <robin@gareus.org>
Thu, 29 Nov 2018 13:25:22 +0000 (14:25 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 29 Nov 2018 13:25:22 +0000 (14:25 +0100)
There are two cases:
 (A) Proxy is created first, dialog is created later on demand
 (B) Dialog is created and directly registers its window as proxy

In (B) the dialog is usually on the stack and destroyed when the
ArdourDialog instances leaves scope. In that case ~ArdourDialog()
is called and the proxy remained.

Destroying the proxy does destroy the registered window in ~WindowProxy()
If ArdourDialog's d'tor itself deletes the proxy it would recurse into
itself. Existing APIs e.g. drop_window() likewise delete the window and
cannot be safely called from ~ArdourDialog.

gtk2_ardour/ardour_dialog.cc
gtk2_ardour/window_manager.cc
gtk2_ardour/window_manager.h

index 1c9da0112f1439bf4e50e737fab033607f0a52d2..68f388682a90e2970b92a8cf31045b2a48a04061 100644 (file)
@@ -45,6 +45,7 @@ ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator)
 
 ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool use_seperator)
        : Dialog (title, parent, modal, use_seperator)
+       , proxy (0)
        , _splash_pushed (false)
 {
        init ();
@@ -56,6 +57,7 @@ ArdourDialog::~ArdourDialog ()
        pop_splash ();
        Keyboard::the_keyboard().focus_out_window (0, this);
        WM::Manager::instance().remove (proxy);
+       proxy->explicit_delete ();
 }
 
 void
index 1d63751c5ec369e9f1fe1eee4c768274206b02e0..cdb83fba8b76893918b0ddcb39bb823a407f791c 100644 (file)
@@ -255,11 +255,6 @@ ProxyTemporary::ProxyTemporary (const string& name, Gtk::Window* win)
        _window = win;
 }
 
-ProxyTemporary::~ProxyTemporary ()
-{
-}
-
-
 ARDOUR::SessionHandlePtr*
 ProxyTemporary::session_handle()
 {
index a5a9714cc8c376cc5fd116f31496544b7a1d90c0..93d71add928244f63cfe691a3d79dc6e3375e54d 100644 (file)
@@ -97,7 +97,6 @@ class ProxyTemporary: public ProxyBase
 {
 public:
        ProxyTemporary (const std::string& name, Gtk::Window* win);
-       ~ProxyTemporary();
 
        Gtk::Window* get (bool create = false) {
                (void) create;
@@ -109,6 +108,8 @@ public:
        }
 
        ARDOUR::SessionHandlePtr* session_handle ();
+
+       void explicit_delete () { _window = 0 ; delete this; }
 };
 
 template<typename T>