13
0

Fix crash when removing plugin with mapped controllable #8756

MidiControlUI drops the reference to a given controllable in
its own thread. This can happen after the plugin is already
destroyed (even though the PBD::Controllable still exists).
This commit is contained in:
Robin Gareus 2021-06-21 05:27:11 +02:00
parent 3b1c52dbd0
commit db1821a363
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 3 additions and 5 deletions

View File

@ -135,7 +135,7 @@ MIDIControllable::set_controllable (boost::shared_ptr<PBD::Controllable> c)
return;
}
controllable_death_connections.drop_connections ();
controllable_death_connection.disconnect ();
if (c) {
_controllable = c;
@ -148,9 +148,7 @@ MIDIControllable::set_controllable (boost::shared_ptr<PBD::Controllable> c)
last_incoming = 256;
if (c) {
c->DropReferences.connect (controllable_death_connections, MISSING_INVALIDATOR,
boost::bind (&MIDIControllable::drop_controllable, this),
MidiControlUI::instance());
c->DropReferences.connect_same_thread (controllable_death_connection, boost::bind (&MIDIControllable::drop_controllable, this));
}
}

View File

@ -134,7 +134,7 @@ private:
int midi_msg_id; /* controller ID or note number */
PBD::ScopedConnection midi_sense_connection[2];
PBD::ScopedConnection midi_learn_connection;
PBD::ScopedConnectionList controllable_death_connections;
PBD::ScopedConnection controllable_death_connection;
/** the type of MIDI message that is used for this control */
MIDI::eventType control_type;
MIDI::byte control_additional;