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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user