13
0

Fix invalid iterator reference when removing plugins

processors.erase (i); invalidates the iterator and references
to the object, so we first need to try-cast and disconnect.
This commit is contained in:
Robin Gareus 2020-08-05 20:24:13 +02:00
parent 6b9a0f923b
commit 57ef7334ef
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -1455,12 +1455,9 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
return 1;
}
_processors.erase (i);
/* stop redirects that send signals to JACK ports
* from causing noise as a result of no longer being run
*/
boost::shared_ptr<IOProcessor> iop = boost::dynamic_pointer_cast<IOProcessor> (*i);
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert>(*i);
@ -1480,6 +1477,8 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
lm.acquire ();
}
_processors.erase (i);
if (configure_processors_unlocked (err, &lm)) {
pstate.restore ();
/* we know this will work, because it worked before :) */