13
0

Use weak-pointer for Controllable learning

This commit is contained in:
Robin Gareus 2019-03-23 01:45:29 +01:00
parent 1dedadd03f
commit 16fe286ed9
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 6 additions and 6 deletions

View File

@ -30,8 +30,8 @@ using namespace PBD;
using namespace std;
PBD::Signal1<void,Controllable*> Controllable::Destroyed;
PBD::Signal1<bool,Controllable*> Controllable::StartLearning;
PBD::Signal1<void,Controllable*> Controllable::StopLearning;
PBD::Signal1<bool, boost::weak_ptr<PBD::Controllable> > Controllable::StartLearning;
PBD::Signal1<void, boost::weak_ptr<PBD::Controllable> > Controllable::StopLearning;
PBD::Signal1<void, boost::weak_ptr<PBD::Controllable> > Controllable::GUIFocusChanged;
const std::string Controllable::xml_node_name = X_("Controllable");

View File

@ -123,8 +123,8 @@ public:
PBD::Signal0<void> LearningFinished;
static PBD::Signal1<bool,PBD::Controllable*> StartLearning;
static PBD::Signal1<void,PBD::Controllable*> StopLearning;
static PBD::Signal1<bool, boost::weak_ptr<PBD::Controllable> > StartLearning;
static PBD::Signal1<void, boost::weak_ptr<PBD::Controllable> > StopLearning;
static PBD::Signal1<void,Controllable*> Destroyed;

View File

@ -91,7 +91,7 @@ bool
BindingProxy::button_press_handler (GdkEventButton *ev)
{
if ( controllable && is_bind_action(ev) ) {
if (Controllable::StartLearning (controllable.get())) {
if (Controllable::StartLearning (controllable)) {
string prompt = _("operate controller now");
if (prompter == 0) {
prompter = new PopUp (Gtk::WIN_POS_MOUSE, 30000, false);
@ -121,7 +121,7 @@ BindingProxy::prompter_hiding (GdkEventAny* /*ev*/)
{
learning_connection.disconnect ();
if (controllable) {
Controllable::StopLearning (controllable.get());
Controllable::StopLearning (controllable);
}
return false;
}