JUCE Assertion failure in juce_Thread.cpp:106


#1

Hi everyone. I am working on a plugin and I am having a problem. I don’t get why but I get an exception throwing me to this function:

` void Thread::threadEntryPoint()
{
const CurrentThreadHolder::Ptr currentThreadHolder (getCurrentThreadHolder());
currentThreadHolder->value = this;

if (threadName.isNotEmpty())
    setCurrentThreadName (threadName);

if (startSuspensionEvent.wait (10000))
{
    jassert (getCurrentThreadId() == threadId);

    if (affinityMask != 0)
        setCurrentThreadAffinityMask (affinityMask);

    try
    {
        run();
    }
    catch (...)
    {
        jassertfalse; // Your run() method mustn't throw any exceptions!
    }
   
}`

The plug in crashes calling jassertfalse in the catch block. It doesn’t do it always. Sometimes the plug in works, sometimes i got that error and the plug in crashes. I really don’t understand…I tried to make some debugging but the thing is that it looks like not depending on the code: sometimes it throws the jassertfalse immediately before playing a midi note…when it doesn’t throw the Jassertfalse everything works perfectly. I’m using both juce host and Ableton LIve to run it, and it crashes in both cases.


#2

So whatever code is running in that thread throws an exception. It’s impossible to guide you without more context. Most importantly, what is this thread’s purpose? Is it running your user code? If, guard your entrypoint (your class’ run() function) with a try/catch block catching a std::exception, you can then query the exception for information about the error.

It should also be possible to set up xcode to break on thrown exceptions, which will give you more information.