13
0

Binding Proxy: Drop references as requested.

This commit is contained in:
Robin Gareus 2017-07-30 02:40:45 +02:00
parent 6f80a5ba0f
commit edcfa23e14
2 changed files with 16 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include <iostream>
#include "pbd/controllable.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/keyboard.h"
#include "widgets/binding_proxy.h"
#include "widgets/popup.h"
@ -38,6 +39,12 @@ BindingProxy::BindingProxy (boost::shared_ptr<Controllable> c)
: prompter (0),
controllable (c)
{
if (c) {
c->DropReferences.connect (
_controllable_going_away_connection, invalidator (*this),
boost::bind (&BindingProxy::set_controllable, this, boost::shared_ptr<Controllable> ()),
gui_context());
}
}
BindingProxy::BindingProxy ()
@ -57,6 +64,14 @@ BindingProxy::set_controllable (boost::shared_ptr<Controllable> c)
{
learning_finished ();
controllable = c;
_controllable_going_away_connection.disconnect ();
if (c) {
c->DropReferences.connect (
_controllable_going_away_connection, invalidator (*this),
boost::bind (&BindingProxy::set_controllable, this, boost::shared_ptr<Controllable> ()),
gui_context());
}
}
void

View File

@ -59,6 +59,7 @@ protected:
static guint bind_statemask;
PBD::ScopedConnection learning_connection;
PBD::ScopedConnection _controllable_going_away_connection;
void learning_finished ();
bool prompter_hiding (GdkEventAny *);
};