jpcima / ysfx

Hosting library for JSFX
Apache License 2.0
158 stars 25 forks source link

Crash when removing and re-adding ysfx instance #67

Open AnClark opened 1 year ago

AnClark commented 1 year ago

I've found another critical bug while using ysfx on REAPER (Windows edition): when I insert a ysfx instance in REAPER FX-Chain, remove it, and re-add it, ysfx will crash.

Tested on the commit 8077347, with MSVC compiler and CMake Debug profile.

Here's a backtrace from LLDB (copied PDB file to the same path of ysfx.vst3 file in advance):

(lldb) target create "reaper"
(lldb) Current executable set to 'C:\Program Files\REAPER (x64)\reaper.exe' (x86_64).
(lldb) run
(lldb) Process 17656 launched: 'C:\Program Files\REAPER (x64)\reaper.exe' (x86_64)
Process 17656 stopped
* thread #1, stop reason = Exception 0x80000003 encountered at address 0x7ffba639a9ac
    frame #0: 0x00007ffba639a9ad ysfx.vst3`juce::SingletonHolder<juce::VBlankDispatcher,juce::DummyCriticalSection,1>::get(this=0x00007ffba6af2088) at juce_Singleton.h:74
   71               {
   72                   // This means that the doNotRecreateAfterDeletion flag was set
   73                   // and you tried to create the singleton more than once.
-> 74                   jassertfalse;
   75                   return nullptr;
   76               }
   77
(lldb) bt
* thread #1, stop reason = Exception 0x80000003 encountered at address 0x7ffba639a9ac
  * frame #0: 0x00007ffba639a9ad ysfx.vst3`juce::SingletonHolder<juce::VBlankDispatcher,juce::DummyCriticalSection,1>::get(this=0x00007ffba6af2088) at juce_Singleton.h:74
    frame #1: 0x00007ffba63ad6a2 ysfx.vst3`juce::VBlankDispatcher::getInstance at juce_win32_Windowing.cpp:1576
    frame #2: 0x00007ffba62ed60f ysfx.vst3`juce::HWNDComponentPeer::HWNDComponentPeer(this=0x0000000013278980) at juce_win32_Windowing.cpp:1660
    frame #3: 0x00007ffba617ab98 ysfx.vst3`juce::Component::createNewPeer at juce_win32_Windowing.cpp:4611
    frame #4: 0x00007ffba6171153 ysfx.vst3`juce::Component::addToDesktop at juce_Component.cpp:721
    frame #5: 0x00007ffba61cd52c ysfx.vst3`juce::TopLevelWindow::TopLevelWindow at juce_TopLevelWindow.cpp:142
    frame #6: 0x00007ffba61d54de ysfx.vst3`juce::ResizableWindow::ResizableWindow at juce_ResizableWindow.cpp:36
    frame #7: 0x00007ffba61d7c13 ysfx.vst3`juce::DocumentWindow::DocumentWindow(this=0x0000000013278610) at juce_DocumentWindow.cpp:52
    frame #8: 0x00007ffba65bdd27 ysfx.vst3`YsfxEditor::Impl::CodeWindow::CodeWindow(this=0x0000000013278610) + 55
    frame #9: 0x00007ffba65b8140 ysfx.vst3`YsfxEditor::Impl::createUI(this=0x00000000135a1e80) at editor.cpp:374
    frame #10: 0x00007ffba65b57cc ysfx.vst3`YsfxEditor::YsfxEditor(this=0x00000000135bb040, proc=0x000000001342d920) at editor.cpp:105
    frame #11: 0x00007ffba654d6b0 ysfx.vst3`YsfxProcessor::createEditor(this=0x000000001342d920) at processor.cpp:292
    frame #12: 0x00007ffba64b89b0 ysfx.vst3`juce::AudioProcessor::createEditorIfNeeded at juce_AudioProcessor.cpp:899
    frame #13: 0x00007ffba5e721a9 ysfx.vst3`juce::JuceVST3EditController::JuceVST3Editor::ContentWrapperComponent::createEditor at juce_VST3_Wrapper.cpp:2037
    frame #14: 0x00007ffba5e71ebc ysfx.vst3`juce::JuceVST3EditController::JuceVST3Editor::createContentWrapperComponentIfNeeded at juce_VST3_Wrapper.cpp:2217
    frame #15: 0x00007ffba5e40491 ysfx.vst3`juce::JuceVST3EditController::JuceVST3Editor::JuceVST3Editor at juce_VST3_Wrapper.cpp:1695
    frame #16: 0x00007ffba5e73332 ysfx.vst3`juce::JuceVST3EditController::createView at juce_VST3_Wrapper.cpp:1218
JoepVanlier commented 3 days ago

Very late reply, but in case someone finds this in the future, this is an issue in JUCE and was fixed upstream.

You can fix it by bumping to a later version. I'm not the developer, but if you just want a build with just that change, you can download it here.