disconnect from a Controllable when it is destroyed
git-svn-id: svn://localhost/ardour2/branches/3.0@12938 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
06ad59e936
commit
a054a74dd2
@ -30,6 +30,7 @@
|
||||
#include "midi++/channel.h"
|
||||
|
||||
#include "ardour/automation_control.h"
|
||||
#include "ardour/midi_ui.h"
|
||||
#include "ardour/utils.h"
|
||||
|
||||
#include "midicontrollable.h"
|
||||
@ -76,7 +77,7 @@ MIDIControllable::MIDIControllable (GenericMidiControlProtocol* s, Port& p, Cont
|
||||
|
||||
MIDIControllable::~MIDIControllable ()
|
||||
{
|
||||
drop_external_control ();
|
||||
drop_controllable ();
|
||||
}
|
||||
|
||||
int
|
||||
@ -111,6 +112,7 @@ MIDIControllable::drop_external_control ()
|
||||
void
|
||||
MIDIControllable::set_controllable (Controllable* c)
|
||||
{
|
||||
drop_controllable ();
|
||||
controllable = c;
|
||||
}
|
||||
|
||||
@ -198,10 +200,21 @@ MIDIControllable::lookup_controllable()
|
||||
}
|
||||
|
||||
controllable = c.get();
|
||||
controllable->Destroyed.connect (controllable_death_connection, MISSING_INVALIDATOR,
|
||||
boost::bind (&MIDIControllable::drop_controllable, this),
|
||||
MidiControlUI::instance());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
MIDIControllable::drop_controllable ()
|
||||
{
|
||||
drop_external_control ();
|
||||
controllable_death_connection.disconnect ();
|
||||
controllable = 0;
|
||||
}
|
||||
|
||||
void
|
||||
MIDIControllable::midi_sense_note (Parser &, EventTwoBytes *msg, bool /*is_on*/)
|
||||
{
|
||||
|
@ -107,6 +107,7 @@ class MIDIControllable : public PBD::Stateful
|
||||
int midi_msg_id; /* controller ID or note number */
|
||||
PBD::ScopedConnection midi_sense_connection[2];
|
||||
PBD::ScopedConnection midi_learn_connection;
|
||||
PBD::ScopedConnection controllable_death_connection;
|
||||
/** the type of MIDI message that is used for this control */
|
||||
MIDI::eventType control_type;
|
||||
MIDI::byte control_additional;
|
||||
@ -118,7 +119,8 @@ class MIDIControllable : public PBD::Stateful
|
||||
bool _bank_relative;
|
||||
|
||||
int lookup_controllable();
|
||||
|
||||
void drop_controllable();
|
||||
|
||||
void midi_receiver (MIDI::Parser &p, MIDI::byte *, size_t);
|
||||
void midi_sense_note (MIDI::Parser &, MIDI::EventTwoBytes *, bool is_on);
|
||||
void midi_sense_note_on (MIDI::Parser &p, MIDI::EventTwoBytes *tb);
|
||||
|
Loading…
Reference in New Issue
Block a user