Delete temporary Window Proxy for dialogs

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.
This commit is contained in:
Robin Gareus 2018-11-29 14:25:22 +01:00
parent fc24b9f0b7
commit e42699600b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 4 additions and 6 deletions

View 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

View File

@ -255,11 +255,6 @@ ProxyTemporary::ProxyTemporary (const string& name, Gtk::Window* win)
_window = win;
}
ProxyTemporary::~ProxyTemporary ()
{
}
ARDOUR::SessionHandlePtr*
ProxyTemporary::session_handle()
{

View 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>