Issue with closing plugin in Plugin Host

I’ve been trying to track down issues when closing my plugin in the JUCE Plugin Host and have managed to narrow it down and reproduce as follows:

[list][]Create a new plugin project using Introjucer[/]
[]Add a slider ([color=#0080FF]ScopedPointer slider;[/color] as private member, [color=#0080FF]addAndMakeVisible ( slider = new Slider ( String::empty ) );[/color] in constructor)[/]
[]Launch Plugin Host.exe via debugger (prepare a filtergraph with the plugin beforehand and use it as the command argument)[/]
[]Open plugin editor window[/]
[]Close Plugin Host[/]
[]Breakpoint gets triggered in ScopedPointer assignment (if I press continue 12 times everything terminates OK)[/][/list]
This happens with Debug & Release builds of Plugin Host. Problem is not apparent if you use Plugin Host outside the debugger. I’m using the latest tip and VS2012 on Win8 x64 (humour me Vinnie!).

Stack trace:

[code] vrfcore.dll!70293355() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for vrfcore.dll]
vfbasics.dll!61baa370() Unknown
vfbasics.dll!61baaba3() Unknown

Plugin Host.exe!juce::ScopedPointer::operator=(MainHostWindow * const newObjectToTakePossessionOf) Line 138 C++
vfbasics.dll!61ba8803() Unknown
vfbasics.dll!61ba8831() Unknown
vfbasics.dll!61ba6ab0() Unknown
vfbasics.dll!61ba67e9() Unknown
ntdll.dll!77706be9() Unknown
ntdll.dll!776dad18() Unknown
ntdll.dll!776c278e() Unknown
vfbasics.dll!61ba6d8e() Unknown
KernelBase.dll!75aaeafb() Unknown
Plugin Host.exe!juce::DynamicLibrary::close() Line 352 C++
Plugin Host.exe!juce::ModuleHandle::close() Line 452 C++
Plugin Host.exe!juce::ModuleHandle::~ModuleHandle() Line 406 C++
Plugin Host.exe!juce::ModuleHandle::scalar deleting destructor'(unsigned int) C++ Plugin Host.exe!juce::ReferenceCountedObject::decReferenceCount() Line 87 C++ Plugin Host.exe!juce::ReferenceCountedObjectPtr<juce::ModuleHandle>::operator=(juce::ModuleHandle * const newObject) Line 300 C++ Plugin Host.exe!juce::VSTPluginInstance::~VSTPluginInstance() Line 795 C++ Plugin Host.exe!juce::VSTPluginInstance::scalar deleting destructor’(unsigned int) C++
Plugin Host.exe!juce::ScopedPointerjuce::AudioProcessor::~ScopedPointerjuce::AudioProcessor() Line 97 C++
Plugin Host.exe!juce::AudioProcessorGraph::Node::~Node() C++
Plugin Host.exe!juce::AudioProcessorGraph::Node::scalar deleting destructor'(unsigned int) C++ Plugin Host.exe!juce::ReferenceCountedObject::decReferenceCount() Line 87 C++ Plugin Host.exe!juce::ReferenceCountedObjectPtr<juce::AudioProcessorGraph::Node>::~ReferenceCountedObjectPtr<juce::AudioProcessorGraph::Node>() Line 312 C++ Plugin Host.exe!juce::GraphRenderingOps::ProcessBufferOp::~ProcessBufferOp() C++ Plugin Host.exe!juce::GraphRenderingOps::ProcessBufferOp::scalar deleting destructor’(unsigned int) C++
Plugin Host.exe!juce::deleteRenderOpArray(juce::Array<void *,juce::DummyCriticalSection> & ops) Line 1165 C++
Plugin Host.exe!juce::AudioProcessorGraph::clearRenderingSequence() Line 1177 C++
Plugin Host.exe!juce::AudioProcessorGraph::~AudioProcessorGraph() Line 938 C++
Plugin Host.exe!FilterGraph::~FilterGraph() Line 79 C++
Plugin Host.exe!GraphDocumentComponent::~GraphDocumentComponent() Line 1047 C++
Plugin Host.exe!GraphDocumentComponent::scalar deleting destructor'(unsigned int) C++ Plugin Host.exe!juce::Component::SafePointer<juce::Component>::deleteAndZero() Line 2111 C++ Plugin Host.exe!juce::ResizableWindow::clearContentComponent() Line 107 C++ Plugin Host.exe!MainHostWindow::~MainHostWindow() Line 135 C++ Plugin Host.exe!MainHostWindow::scalar deleting destructor’(unsigned int) C++
Plugin Host.exe!juce::ScopedPointer::operator=(MainHostWindow * const newObjectToTakePossessionOf) Line 138 C++
Plugin Host.exe!PluginHostApp::shutdown() Line 83 C++
Plugin Host.exe!juce::JUCEApplication::shutdownApp() Line 216 C++
Plugin Host.exe!juce::JUCEApplication::main() Line 246 C++
Plugin Host.exe!WinMain(void * __formal, void * __formal, const char * __formal, int __formal) Line 107 C++
Plugin Host.exe!__tmainCRTStartup() Line 237 C
Plugin Host.exe!WinMainCRTStartup() Line 164 C
kernel32.dll!751b8543() Unknown
ntdll.dll!776bac69() Unknown
ntdll.dll!776bac3c() Unknown

Can anyone else confirm this? Especially with VS2010 on Win7.

PS - This is reminiscent of a post from 2009: Latest juce.Plugin demo hangs host on closing when UI opened.

Come on guys, this is easy to check. Is no-one interested in being able to cleanly debug plugins? Or are you all just assuming I’m being an idiot?

I don’t see how adding a slider could possibly make any difference… The editor component will have been deleted before it gets anywhere near the stack trace you’ve got there. Are you sure that it’s the slider, and not something else…?

Thanks Jules - I don’t see how either, but all I’ve added to the clean plugin project are the two bits in blue in the second dot point. If I comment out the addAndMakeVisible statement, then the problem goes away. Bizarre!

Ok, the only possible explanation must be that the slider is sending a message, and that’s somehow causing trouble… Thanks, I’ll investigate when I get a chance.

I finally noticed that I’d set up MS Application Verifier 6.2 on Plugin Host.exe and forgotten to turn it off. :oops: It was this that was causing all the stops.

I guess the question still remains as to why AppVerifier is detecting problems though…

Hmm…what’s wrong with that?

Hmm…what’s wrong with that?[/quote]

Using VS2012 before the first update, that’s all. Have you forgotten this already? :wink:

SP1 is out, I’m assuming you are using that?

Update 1, yeah (but I wasn’t at the time of the original post).