Open benkuper opened 1 week ago
I made a PR that proposes a ThreadSafeBlockListenerList, and that uses ScopedLock instead of ScopedTryLock After testing in both my minimal setup and my full-blown software with a lot of cross calls between listeners and threads, this seems very stable.
If you're interested in the context from which I find and publish all the issues, this is the software I develop and test Juce 8 against : https://benjamin.kuperberg.fr/chataigne
Detailed steps on how to reproduce the bug
using ThreadSafeListener should prevent from triggering an assert when calling from multiple threads (as per indication in the assert comments), but it still trigger it.
_EDIT : Reading the ListenerList function where it happens, the ScopedTryLock on line 233 of juceListenerList.h is intriguing to me. Shouldn't there be a function that blocks and ensure the lock is gained (so ScopedLock) when we're using CriticalSection ? Right now, I don't really see what's the actual function of ThreadSafe except telling me that it may not be safe.
Minimal test case :
This is a visual representation of the above description :
I believe this should not trigger the assert, and in scenarios where calls are done repeatedly, this makes impossible to debug as the assert will stop the program every time.
here is the full code :
Operating systems
Windows
What versions of the operating systems?
11
Architectures
64-bit
Stacktrace
No response
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the
develop
branchThe bug is present on the
develop
branchCode of Conduct