My plug got hung at instantiation


#1

hi,

My host (reaper) hung during my plugin's instantiation yesterday, for the first time.
I launched it many many many times before and it never happened, so I'm not sure what's going on here. probably a subtle race condition (?) or something.
It stayed locked in there :


AudioProcessorEditor* AudioProcessor::createEditorIfNeeded()
{
    if (activeEditor != nullptr)
        return activeEditor;
    AudioProcessorEditor* const ed = createEditor();
    // You must make your hasEditor() method return a consistent result!
    jassert (hasEditor() == (ed != nullptr));
    if (ed != nullptr)
    {
        // you must give your editor comp a size before returning it..
        jassert (ed->getWidth() > 0 && ed->getHeight() > 0);
        const ScopedLock sl (callbackLock);
        activeEditor = ed;
    }
    return ed;
}

I did not look enough at the trace, and as it's probably something subtle, I can't reproduce it…
any clue or idea about what could have happened?
Any thing in particular I should look at if it happens again?


#2

On its own that function isn't much help - you'd need to look at the whole stack trace for that thread, and also whatever other thread is deadlocked, and see what locks they're both holding. Most likely there's something in your audio callback that's trying to use the GUI thread, but you'd need to debug and see.