diff options
author | Robin Gareus <robin@gareus.org> | 2017-07-30 02:40:45 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-07-30 02:42:55 +0200 |
commit | edcfa23e14d968605bd5f07ae6b0793229f11f2c (patch) | |
tree | 2b9db80cb33c55fabdd1ee513efc9802126b29e6 /libs/widgets/binding_proxy.cc | |
parent | 6f80a5ba0fc7516a14492e357fe036a9bed5638d (diff) |
Binding Proxy: Drop references as requested.
Diffstat (limited to 'libs/widgets/binding_proxy.cc')
-rw-r--r-- | libs/widgets/binding_proxy.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/widgets/binding_proxy.cc b/libs/widgets/binding_proxy.cc index 666797a0eb..85119ab1c0 100644 --- a/libs/widgets/binding_proxy.cc +++ b/libs/widgets/binding_proxy.cc @@ -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 |