steinbergmedia / vstgui

A user interface toolkit mainly for audio plug-ins
Other
850 stars 121 forks source link

Standalone application crash with newest version of vst3sdk (3.7.9) on Windows when using transforms #308

Closed erikgrahn13 closed 8 months ago

erikgrahn13 commented 8 months ago

I have a custom control where I do some primitive drawing functions like drawLine(). When trying to apply transform to that control to be able to rotate, it crashes. This did not happen when using vst3sdk version 3.7.8 and the corresponding submodule of vstgui of that release.

Some quick troubleshooting I have done:

I removed all my primitive drawing functions except one call to drawLine() in my draw() after the transform function and this is the call stack: CallStack:

d2d1.dll!00007ff8f8f821d4() (Unknown Source:0)
d2d1.dll!00007ff8f8f8bc42() (Unknown Source:0)
d2d1.dll!00007ff8f8f89410() (Unknown Source:0)
d2d1.dll!00007ff8f8f92d4d() (Unknown Source:0)
d2d1.dll!00007ff8f8f9b9c5() (Unknown Source:0)
d2d1.dll!00007ff8f8f9433a() (Unknown Source:0)
d2d1.dll!00007ff8f8f93caf() (Unknown Source:0)
dcomp.dll!00007ff8f95482ec() (Unknown Source:0)
dcomp.dll!00007ff8f954c33d() (Unknown Source:0)
Black_Lounge-app.exe!VSTGUI::DirectComposition::Factory::Impl::commit() Line 749 (c:\Users\erikg\Development\plugins\vst3sdk\vstgui4\vstgui\lib\platform\win32\win32directcomposition.cpp:749)
Black_Lounge-app.exe!VSTGUI::DirectComposition::`anonymous namespace'::RootVisual::commit() Line 545 (c:\Users\erikg\Development\plugins\vst3sdk\vstgui4\vstgui\lib\platform\win32\win32directcomposition.cpp:545)
Black_Lounge-app.exe!VSTGUI::Win32Frame::paint(HWND__ * hwnd) Line 669 (c:\Users\erikg\Development\plugins\vst3sdk\vstgui4\vstgui\lib\platform\win32\win32frame.cpp:669)
Black_Lounge-app.exe!VSTGUI::Win32Frame::proc(HWND__ * hwnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 796 (c:\Users\erikg\Development\plugins\vst3sdk\vstgui4\vstgui\lib\platform\win32\win32frame.cpp:796)
Black_Lounge-app.exe!`VSTGUI::Standalone::Platform::Win32::Window::onSetContentView'::`5'::<lambda_1>::operator()(HWND__ * hwnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 247 (c:\Users\erikg\Development\plugins\vst3sdk\vstgui4\vstgui\standalone\source\platform\win32\win32window.cpp:247)
Black_Lounge-app.exe!std::invoke<`VSTGUI::Standalone::Platform::Win32::Window::onSetContentView'::`5'::<lambda_1> &,HWND__ *,unsigned int,unsigned __int64,__int64>(VSTGUI::Standalone::Platform::Win32::Window::onSetContentView::__l5::<lambda_1> & _Obj, HWND__ * && _Arg1, unsigned int && <_Args2_0>, unsigned __int64 && <_Args2_1>, __int64 && <_Args2_2>) Line 1587 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\type_traits:1587)
Black_Lounge-app.exe!std::_Invoker_ret<__int64>::_Call<`VSTGUI::Standalone::Platform::Win32::Window::onSetContentView'::`5'::<lambda_1> &,HWND__ *,unsigned int,unsigned __int64,__int64>(VSTGUI::Standalone::Platform::Win32::Window::onSetContentView::__l5::<lambda_1> & _Func, HWND__ * && <_Vals_0>, unsigned int && <_Vals_1>, unsigned __int64 && <_Vals_2>, __int64 && <_Vals_3>) Line 674 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\functional:674)
Black_Lounge-app.exe!std::_Func_impl_no_alloc<`VSTGUI::Standalone::Platform::Win32::Window::onSetContentView'::`5'::<lambda_1>,__int64,HWND__ *,unsigned int,unsigned __int64,__int64>::_Do_call(HWND__ * && <_Args_0>, unsigned int && <_Args_1>, unsigned __int64 && <_Args_2>, __int64 && <_Args_3>) Line 834 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\functional:834)
Black_Lounge-app.exe!std::_Func_class<__int64,HWND__ *,unsigned int,unsigned __int64,__int64>::operator()(HWND__ * <_Args_0>, unsigned int <_Args_1>, unsigned __int64 <_Args_2>, __int64 <_Args_3>) Line 875 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\functional:875)
Black_Lounge-app.exe!VSTGUI::Standalone::Platform::Win32::Window::proc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 673 (c:\Users\erikg\Development\plugins\vst3sdk\vstgui4\vstgui\standalone\source\platform\win32\win32window.cpp:673)
Black_Lounge-app.exe!VSTGUI::Standalone::Platform::Win32::WndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 128 (c:\Users\erikg\Development\plugins\vst3sdk\vstgui4\vstgui\standalone\source\platform\win32\win32window.cpp:128)
erikgrahn13 commented 8 months ago

After some more digging it seems that it is this commit that introduces the crashes for me: https://github.com/steinbergmedia/vstgui/pull/274/commits/afb04d374eeb00a97f0e906a94ce147c890bafd8

scheffle commented 8 months ago

Can you build a Debug version and look at the Debug Output console? What's printed there?

erikgrahn13 commented 8 months ago

I built a Debug version and have pasted the Debug Console from VScode below. Is that what you meant?

-------------------------------------------------------------------
You may only use the C/C++ Extension for Visual Studio Code
with Visual Studio Code, Visual Studio or Visual Studio for Mac
software to help you develop and test your applications.
-------------------------------------------------------------------
Breakpoint warning: No executable code of the debugger’s target code type is associated with this line.
Possible causes include: conditional compilation, compiler optimizations, or the target architecture of this line is not supported by the current debugger code type. - c:\Users\erikg\Development\plugins\vst3sdk\vstgui4\vstgui\standalone\include\helpers\uidesc\modelbinding.h:43
Loaded 'C:\Users\erikg\Development\plugins\Black Lounge\build\APP\Debug\Black_Lounge-app\Black_Lounge-app.exe'. Symbols loaded.
Loaded 'C:\Windows\System32\ntdll.dll'.
Loaded 'C:\Windows\System32\kernel32.dll'.
Loaded 'C:\Windows\System32\KernelBase.dll'.
Loaded 'C:\Windows\System32\apphelp.dll'.
Loaded 'C:\Windows\System32\ole32.dll'.
Loaded 'C:\Windows\System32\msvcp_win.dll'.
Loaded 'C:\Windows\System32\ucrtbase.dll'.
Loaded 'C:\Windows\System32\mfplat.dll'.
Loaded 'C:\Windows\System32\gdi32.dll'.
Loaded 'C:\Windows\System32\sechost.dll'.
Loaded 'C:\Windows\System32\SHCore.dll'.
Loaded 'C:\Windows\System32\win32u.dll'.
Loaded 'C:\Windows\System32\gdi32full.dll'.
Loaded 'C:\Windows\System32\cfgmgr32.dll'.
Loaded 'C:\Windows\System32\user32.dll'.
Loaded 'C:\Windows\System32\combase.dll'.
Loaded 'C:\Windows\System32\rpcrt4.dll'.
Loaded 'C:\Windows\System32\shell32.dll'.
Loaded 'C:\Windows\System32\advapi32.dll'.
Loaded 'C:\Windows\System32\msvcrt.dll'.
Loaded 'C:\Windows\System32\shlwapi.dll'.
Loaded 'C:\Windows\System32\msvcp140d.dll'.
Loaded 'C:\Windows\System32\d2d1.dll'.
Loaded 'C:\Windows\System32\msvcp140d_codecvt_ids.dll'.
Loaded 'C:\Windows\System32\d3d11.dll'.
Loaded 'C:\Windows\System32\DWrite.dll'.
Loaded 'C:\Windows\System32\dwmapi.dll'.
Loaded 'C:\Windows\System32\opengl32.dll'.
Loaded 'C:\Windows\System32\vcruntime140d.dll'.
Loaded 'C:\Windows\System32\vcruntime140_1d.dll'.
Loaded 'C:\Windows\System32\ucrtbased.dll'.
Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2215_none_270d72677387dfc3\comctl32.dll'.
Loaded 'C:\Windows\System32\ucrtbased.dll'.
Unloaded 'C:\Windows\System32\ucrtbased.dll'.
Loaded 'C:\Windows\System32\dxgi.dll'.
Loaded 'C:\Windows\System32\glu32.dll'.
Loaded 'C:\Windows\System32\DXCore.dll'.
Loaded 'C:\Windows\System32\kernel.appcore.dll'.
Loaded 'C:\Windows\System32\bcryptprimitives.dll'.
Loaded 'C:\Windows\System32\RTWorkQ.dll'.
Loaded 'C:\Windows\System32\imm32.dll'.
Loaded 'C:\Windows\System32\uxtheme.dll'.
Loaded 'C:\Windows\System32\clbcatq.dll'.
Loaded 'C:\Windows\System32\WindowsCodecs.dll'.
Loaded 'C:\Windows\System32\dcomp.dll'.
Loaded 'C:\Windows\System32\DXGIDebug.dll'.
Loaded 'C:\Windows\System32\ResourcePolicyClient.dll'.
Unloaded 'C:\Windows\System32\ResourcePolicyClient.dll'.
Loaded 'C:\Windows\System32\directxdatabasehelper.dll'.
Loaded 'C:\Windows\System32\DriverStore\FileRepository\nv_dispui.inf_amd64_c3352d3df1cf4d8c\nvldumdx.dll'.
Loaded 'C:\Windows\System32\version.dll'.
Loaded 'C:\Windows\System32\msasn1.dll'.
Loaded 'C:\Windows\System32\cryptnet.dll'.
Loaded 'C:\Windows\System32\crypt32.dll'.
Loaded 'C:\Windows\System32\drvstore.dll'.
Loaded 'C:\Windows\System32\devobj.dll'.
Loaded 'C:\Windows\System32\wldp.dll'.
Loaded 'C:\Windows\System32\cryptbase.dll'.
Loaded 'C:\Windows\System32\wintrust.dll'.
Loaded 'C:\Windows\System32\imagehlp.dll'.
Loaded 'C:\Windows\System32\cryptsp.dll'.
Loaded 'C:\Windows\System32\rsaenh.dll'.
Loaded 'C:\Windows\System32\bcrypt.dll'.
Loaded 'C:\Windows\System32\DriverStore\FileRepository\nv_dispui.inf_amd64_c3352d3df1cf4d8c\nvwgf2umx.dll'.
Loaded 'C:\Windows\System32\winmm.dll'.
Loaded 'C:\Windows\System32\DriverStore\FileRepository\nv_dispui.inf_amd64_c3352d3df1cf4d8c\NvCamera\NvCameraAllowlisting64.dll'.
Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nv_dispui.inf_amd64_c3352d3df1cf4d8c\NvCamera\NvCameraAllowlisting64.dll'.
Loaded 'C:\Windows\System32\windows.storage.dll'.
Loaded 'C:\Windows\System32\WinTypes.dll'.
Loaded 'C:\Windows\System32\nvspcap64.dll'.
Loaded 'C:\Windows\System32\profapi.dll'.
Loaded 'C:\Windows\System32\ntmarta.dll'.
Loaded 'C:\Windows\System32\DriverStore\FileRepository\nv_dispui.inf_amd64_c3352d3df1cf4d8c\Display.NvContainer\MessageBus.dll'.
Loaded 'C:\Windows\System32\ws2_32.dll'.
Loaded 'C:\Windows\System32\IPHLPAPI.DLL'.
Exception thrown at 0x00007FF8FCC2531C in Black_Lounge-app.exe: Microsoft C++ exception: Poco::NotFoundException at memory location 0x000000A474182100.
Exception thrown at 0x00007FF8FCC2531C in Black_Lounge-app.exe: Microsoft C++ exception: Poco::NotFoundException at memory location 0x000000A474182140.
Loaded 'C:\Windows\System32\d3d11_3SDKLayers.dll'.
Loaded 'C:\Windows\System32\nsi.dll'.
Loaded 'C:\Windows\System32\dhcpcsvc.dll'.
Loaded 'C:\Windows\System32\msctf.dll'.
Loaded 'C:\Windows\System32\TextShaping.dll'.
Loaded 'C:\Windows\System32\DataExchange.dll'.
Loaded 'C:\Windows\System32\twinapi.appcore.dll'.
Loaded 'C:\Windows\System32\TextInputFramework.dll'.
Loaded 'C:\Windows\System32\oleaut32.dll'.
Loaded 'C:\Windows\System32\CoreMessaging.dll'.
Loaded 'C:\Windows\System32\CoreUIComponents.dll'.

RtAudio: no compiled support for specified API argument!

Loaded 'C:\Windows\System32\MMDevAPI.dll'.
Loaded 'C:\Windows\System32\AudioSes.dll'.
Loaded 'C:\Windows\System32\ResourcePolicyClient.dll'.
Exception thrown at 0x00007FF8F8FEC9C0 (d2d1.dll) in Black_Lounge-app.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
The program '[14356] Black_Lounge-app.exe' has exited with code 0 (0x0).
scheffle commented 8 months ago

Yes thanks, the line Exception thrown at 0x00007FF8F8FEC9C0 (d2d1.dll) in Black_Lounge-app.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF. helps a lot in this case.

scheffle commented 8 months ago

Hi @erikgrahn13 , please checkout the develop branch and see if this is fixed for you. Thank you.

erikgrahn13 commented 8 months ago

Hello @scheffle ! Yes it works! Awesome job man! Thank you very much for your quick support during the weekend!