never send signals while nodes are still locked

A signal emitted and received in the same thread will call other functions
before returning to the one that emitted the signal. If these other functions
try to lock a mutex while a mutex is already locked by the emitting function,
we get stuck in a deadlock. These changes ensure that a signal is never emitted
by any function until all the nodes locked by it are unlocked.
This commit is contained in:
itsmattkc
2019-11-23 17:04:33 +09:00
parent cb5d816145
commit 1bc8a20425
2 changed files with 35 additions and 10 deletions
+6 -3
View File
@@ -178,16 +178,19 @@ const rational &Block::media_in()
void Block::set_media_in(const rational &media_in)
{
LockUserInput();
bool changed = false;
LockUserInput();
if (media_in_ != media_in) {
media_in_ = media_in;
changed = true;
}
UnlockUserInput();
if (changed) {
// Signal that this clips contents have changed
SendInvalidateCache(in(), out());
}
UnlockUserInput();
}
const QString &Block::block_name()