Having troubles again with my audio plugin. When the host quits, the program crashes on windows with the code 0xC000000D (Invalid parameter to service or function). I didn't really realize when it happened, because it only happens in release mode, and i develop in debug mode. It might have been there since i started with juce for all i know.
In the release, x64 build, it throws the exception here (crt0dat.c: line 628 - function doexit()):
Heres the rest of the stacktrace not shown in the picture:
ntdll.dll!000000007749ad1f() Unknown d3d10warp.dll!000007feedf0e792() Unknown d3d10warp.dll!000007feedf0d104() Unknown d3d10warp.dll!000007feede3e817() Unknown d3d10warp.dll!000007feede3ea58() Unknown dxgi.dll!000007fef65120e7() Unknown d3d10_1core.dll!000007fef5b4c45a() Unknown dxgi.dll!000007fef6511fef() Unknown dxgi.dll!000007fef651221f() Unknown dxgi.dll!000007fef6512068() Unknown dxgi.dll!000007fef651201d() Unknown dxgi.dll!000007fef6502aca() Unknown d2d1.dll!000007feefe586b5() Unknown d2d1.dll!000007feefe50a1e() Unknown d2d1.dll!000007feefe50a85() Unknown d2d1.dll!000007feefe4d3a8() Unknown d2d1.dll!000007feefe29559() Unknown d2d1.dll!000007feefe29d72() Unknown d2d1.dll!000007feefe29e24() Unknown z.dll!`juce::Direct2DFactories::getInstance'::`2'::`dynamic atexit destructor for 'instance''() C++ > z.dll!doexit(int code, int quick, int retcaller) Line 628 C z.dll!_CRT_INIT(void * hDllHandle, unsigned long dwReason, void * lpreserved) Line 169 C z.dll!__DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved) Line 399 C ntdll.dll!0000000077444371() Unknown ntdll.dll!0000000077444180() Unknown
Originally, the x64 build failed with 0xC000005 but that was because it ignored the original exception, followed by a stack overflow exception, then the invalid exception. Breaking on all exceptions lead me there.
In the release, x32 build, it throws the exception here (juce_win32_DirectWriteTypeface.cpp: line 106)
~Direct2DFactories() { d2dFactory = nullptr; // (need to make sure these are released before deleting the DynamicLibrary objects) directWriteFactory = nullptr; // <- crash systemFonts = nullptr; }
Unfortunately, there's no meaningful stacktrace for x32 (just [external code] and this deconstructor). However, it seems to be clear that the exception happens on static storage destruction of some direct2d objects. I dont have any significant static data (besides some global boolean flags) that require destruction at exit to my knowledge.
Searching brought this up and it is exactly the same problem: http://www.juce.com/forum/topic/vst-plugin-crash-when-quit-host-latest-tip
However, JUCE_USE_DIRECTWRITE is already not defined in my project (#defining it didn't help either :))
e: I found it and disabling it does remove the crash. Not sure whether it's a loss not to have DirectWrite enabled?
e2: same problem here: http://www.juce.com/forum/topic/showing-tooltip-directwrite-plugin-causes-host-crash
I'd appreciate any input..