juce-framework / JUCE

JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, LV2 and AAX audio plug-ins.
https://juce.com
Other
6.3k stars 1.67k forks source link

[Bug]: TimerThread singleton assertion error on unexpected recreation #1383

Open danra opened 1 month ago

danra commented 1 month ago

Detailed steps on how to reproduce the bug

In any DAW, insert AudioPluginDemo on a track. Then close the project, start a new one, and once again insert AudioPluginDemo. Get an assertion failure due unexpected recreation of the TimerThread singleton.

Tested on current develop branch tip bbc63ba151265d9199b5d1cfd3f70fb24442563f (which also seems like the regressing commit)

What is the expected behaviour?

No assertion failure

Operating systems

macOS

What versions of the operating systems?

-

Architectures

64-bit

Stacktrace

#0  0x00000001384de7d0 in juce::SingletonHolder<juce::Timer::TimerThread, juce::CriticalSection, true>::get() at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_core/memory/juce_Singleton.h:74
#1  0x00000001384d38f0 in juce::Timer::TimerThread::getInstance() at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_events/timers/juce_Timer.cpp:32
#2  0x00000001384d3460 in juce::Timer::startTimer(int) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_events/timers/juce_Timer.cpp:306
#3  0x00000001384d3c80 in juce::Timer::startTimerHz(int) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_events/timers/juce_Timer.cpp:321
#5  0x0000000138295544 in juce::AudioProcessorValueTreeState::AudioProcessorValueTreeState(juce::AudioProcessor&, juce::UndoManager*) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp:264
#4  0x00000001382950f4 in juce::AudioProcessorValueTreeState::AudioProcessorValueTreeState(juce::AudioProcessor&, juce::UndoManager*) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp:265
#6  0x00000001382953f8 in juce::AudioProcessorValueTreeState::AudioProcessorValueTreeState(juce::AudioProcessor&, juce::UndoManager*, juce::Identifier const&, juce::AudioProcessorValueTreeState::ParameterLayout) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp:209
#7  0x00000001380d8070 in JuceDemoPluginAudioProcessor::JuceDemoPluginAudioProcessor() at /Users/dan/dev/JUCE_vanilla/AudioPluginDemo/AudioPluginDemo/Source/AudioPluginDemo.h:184
#8  0x00000001380d7ed0 in JuceDemoPluginAudioProcessor::JuceDemoPluginAudioProcessor() at /Users/dan/dev/JUCE_vanilla/AudioPluginDemo/AudioPluginDemo/Source/AudioPluginDemo.h:187
#9  0x00000001380d7e7c in createPluginFilter() at /Users/dan/dev/JUCE_vanilla/AudioPluginDemo/AudioPluginDemo/Source/Main.cpp:15
#10 0x00000001380555e0 in juce::createPluginFilterOfType(juce::AudioProcessor::WrapperType) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_audio_plugin_client/detail/juce_CreatePluginFilter.h:35
#11 0x000000013805522c in juce::JuceVST3Component::JuceVST3Component(Steinberg::Vst::IHostApplication*) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2436
#12 0x0000000138055140 in juce::JuceVST3Component::JuceVST3Component(Steinberg::Vst::IHostApplication*) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:2438
#13 0x00000001380550b8 in juce::JucePluginFactory::getClassEntries()::'lambda'(Steinberg::Vst::IHostApplication*)::operator()(Steinberg::Vst::IHostApplication*) const at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:4244
#14 0x0000000138055084 in juce::JucePluginFactory::getClassEntries()::'lambda'(Steinberg::Vst::IHostApplication*)::__invoke(Steinberg::Vst::IHostApplication*) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:4242
#15 0x000000013805359c in juce::JucePluginFactory::createInstance(char const*, char const*, void**) at /Users/dan/dev/JUCE_vanilla/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:4130
#16 0x0000000100527f60 in VST_HostedPlugin::VST3_Init(int, char const*, WDL_FastString*) ()
#17 0x00000001003609b4 in VST_HostedPlugin::OpenFromUID(char const*, int, char const*, WDL_FastString*, bool, int) ()
#18 0x0000000100378624 in FxDsp::FxDsp(int, char const*, char const*, void*, int) ()
#19 0x00000001003a87dc in FxChain::addDspToChain(int, char const*, char const*, void*, int, bool) ()
#20 0x00000001003c7558 in fxadd_add_recs_to_chain(FxAddDef**, int, FxChain*, int, int, int, bool, bool) ()
#21 0x00000001003d6c94 in add_to_chain(HWND__*, FxChain*, int, int, int, bool, int, bool) ()
#22 0x00000001003d64dc in do_insert(HWND__*, bool) ()
#23 0x00000001003cb748 in addDialogProc(HWND__*, unsigned int, unsigned long, long) ()
#24 0x00000001004cff8c in SwellDialogDefaultWindowProc(HWND__*, unsigned int, unsigned long, long) ()
#25 0x00000001003cb2e4 in addDialogProc(HWND__*, unsigned int, unsigned long, long) ()
#26 0x00000001004cff8c in SwellDialogDefaultWindowProc(HWND__*, unsigned int, unsigned long, long) ()
#27 0x00000001004ce334 in -[REAPERSwell_hwnd swellOnControlDoubleClick:] ()
#28 0x000000018bebdc70 in -[NSApplication(NSResponder) sendAction:to:from:] ()
#29 0x000000018bebda74 in -[NSControl sendAction:to:] ()
#30 0x000000018bfbee5c in -[NSTableView _sendAction:to:row:column:] ()
#31 0x000000018bfbd698 in -[NSTableView mouseDown:] ()
#32 0x00000001004eafc8 in -[REAPERSwell_listview mouseUp:] ()
#33 0x000000018c851834 in _routeMouseUpEvent ()
#34 0x000000018be43f8c in -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] ()
#35 0x000000018be43c38 in -[NSWindow(NSEventRouting) sendEvent:] ()
#36 0x000000018c509e70 in -[NSApplication(NSEventRouting) sendEvent:] ()
#37 0x0000000100334140 in -[REAPERapp sendEvent:] ()
#38 0x000000018c1578cc in -[NSApplication _handleEvent:] ()
#39 0x000000018bd0bcdc in -[NSApplication run] ()
#40 0x000000018bce2f54 in NSApplicationMain ()
#41 0x000000018805a0e0 in start ()

Plug-in formats (if applicable)

No response

Plug-in host applications (DAWs) (if applicable)

Tested on REAPER but probably any DAW

Testing on the develop branch

The bug is present on the develop branch

Code of Conduct

Anthony-Nicholls commented 1 month ago

Thanks for reporting @danra we're aware of this issue, a number of us are out of the office at the moment we'll get back to this as soon as possible.