So i have a plugin, i build it in debug mode with FORCE_DEBUG enabled (i’m using the introjucer) and it works. I build a release build with FORCE_DEBUG disabled and it crashes in many places, i re-enable the FORCE_DEBUG in the Release build and rebuild it crashes, if i disable FORCE_DEBUG in release build it also crashes… so at the moment only the DEBUG build with FORCE_DEBUG enabled is valid and works. I think it’s not my code that’s at fault here, in the output below the CtrlrProcessor::dtor is the end of my AudioProcessor destructor, nothing else happens on my side, the rest of the stuff is from JUCE. I was wondering what sort of configuration should work and has there been any changes in the wrapper code that might go together with those pre-processor flags ? (this is Windows 7 x32, but i noticed this happens on the MAC too).
CtrlrProcessor::dtor
JUCE Assertion failure in c:\devel\ctrlr\jucelibrarycode\../../juce/juce_amalgamated.h, line 5614
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\ctrlr\jucelibrarycode\../../juce/juce_amalgamated.h, line 5614
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\ctrlr\jucelibrarycode\../../juce/juce_amalgamated.h, line 5614
JUCE Assertion failure in c:\devel\ctrlr\jucelibrarycode\../../juce/juce_amalgamated.h, line 5614
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
JUCE Assertion failure in c:\devel\juce\src\core\../memory/juce_LeakedObjectDetector.h, line 95
'Plugin Host.exe': Unloaded 'C:\devel\ctrlr\Bin\Release\Ctrlr_PluginWin32.dll'
First-chance exception at 0x60aa7360 in Plugin Host.exe: 0xC0000005: Access violation.
Unhandled exception at 0x60aa7360 in Plugin Host.exe: 0xC0000005: Access violation.
Works ok for me… How are you setting FORCE_DEBUG? Unless it’s set identically for all your compilation modules, then there could be terrible linkage problems, e.g. if your headers all think they’re in debug mode, but the cpps are all compiled in release mode.
Hmm, maybe in a plugin some of the VST-specific files don’t include the AppConfig.h header… Maybe try setting the FORCE_DEBUG value as a global definition and see if that makes a difference. It does sound like this is a “mismatched-modules” problem.
allright since i don’t trust myself (and i am a bad programmer) i took your code (latest tip), juce plugin host release build and juce plugin demo release build, what i get when i try to open the editor:
[attachment=0]juce_demo1.png[/attachment]
the compile flags from the AppConfig.h (auto generated by the Introjucer)
then i enable the FORCE_DEBUG flag in the release build and try to load the plugin, i get an assertion and then a crash
JUCE v1.53.65
Initialising VST: JuceDemoPlugin
Opening VST UI: JuceDemoPlugin
JUCE Assertion failure in c:\devel\juce\src\gui\components\../../memory/juce_WeakReference.h, line 180
Plugin Host.exe has triggered a breakpoint
First-chance exception at 0x75b99617 in Plugin Host.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0019f0ac..
First-chance exception at 0x653a488a in Plugin Host.exe: 0xC0000005: Access violation reading location 0x0000003c.
Unhandled exception at 0x653a488a in Plugin Host.exe: 0xC0000005: Access violation reading location 0x0000003c.
First-chance exception at 0x653a488a in Plugin Host.exe: 0xC0000005: Access violation reading location 0x0000003c.
Unhandled exception at 0x653a488a in Plugin Host.exe: 0xC0000005: Access violation reading location 0x0000003c.
When i do the debug build with the FORCE_DEBUG option enabled, it works, once i disable the FORCE_DEBUG option i get a crash when opening the editor
Creating VST instance: JuceDemoPlugin
Initialising VST: JuceDemoPlugin
Opening VST UI: JuceDemoPlugin
First-chance exception at 0x63edf59f (JuceDemoPlugin.dll) in Plugin Host.exe: 0xC0000005: Access violation reading location 0xffd9fb28.
A buffer overrun has occurred in Plugin Host.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.
For more details please see Help topic 'How to debug Buffer Overrun Issues'.
The program '[3168] Plugin Host.exe: Native' has exited with code 0 (0x0).
the debugger jumps here
if (editorComp == 0)
{
AudioProcessorEditor* const ed = filter->createEditorIfNeeded();
if (ed != 0)
{
cEffect.flags |= effFlagsHasEditor;
ed->setOpaque (true);
ed->setVisible (true);
editorComp = new EditorCompWrapper (*this, ed);
}
else /* DEBUGGER JUMPS HERE */
{
cEffect.flags &= ~effFlagsHasEditor;
}
}
i did a release build with the FORCE_DEBUG option set to (Use default from juce_Config.h) and set a preprocessor definition in the Release configuration in the Introjucer: JUCE_FORCE_DEBUG=0 i get the same error
Creating VST instance: JuceDemoPlugin
Initialising VST: JuceDemoPlugin
Opening VST UI: JuceDemoPlugin
JUCE Assertion failure in c:\devel\juce\src\gui\components\../../memory/juce_WeakReference.h, line 180
First-chance exception at 0x75b99617 in Plugin Host.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x002bf4bc..
First-chance exception at 0x75b99617 in Plugin Host.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x002bea04..
That would be the same as not setting the flag at all… So if it crashes, I’d suspect that you’ve not re-compiled everything fully…
I’d really like to find a way of detecting and reporting an error when you try to link different modules that were built with different options, but can’t think of a way to do it… Any elite c++ers care to suggest a trick I could use to do that?