13
0

RegionFX: fix undo/redo of region state

Previously this caused deadlocks (read lock while holding
write lock), and also not dropped references of plugins.

Ideally undo/redo of FX unrelated region state
will not re-instantiate plugins; we can optimize this later.
This commit is contained in:
Robin Gareus 2024-08-27 01:09:06 +02:00
parent 190cd657b9
commit 3ced8cc6bc
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -1579,6 +1579,10 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang
Glib::Threads::RWLock::WriterLock lm (_fx_lock); Glib::Threads::RWLock::WriterLock lm (_fx_lock);
bool changed = !_plugins.empty (); bool changed = !_plugins.empty ();
for (auto const& rfx : _plugins) {
rfx->drop_references ();
}
_plugins.clear (); _plugins.clear ();
for (auto const& child : node.children ()) { for (auto const& child : node.children ()) {
@ -1596,6 +1600,7 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang
changed = true; changed = true;
} }
} }
lm.release ();
if (changed) { if (changed) {
fx_latency_changed (true); fx_latency_changed (true);
fx_tail_changed (true); fx_tail_changed (true);