FlexASIO icon indicating copy to clipboard operation
FlexASIO copied to clipboard

Crash in PortAudioDebugRedirector

Open sjoerdvankreel opened this issue 1 month ago • 9 comments

Hi!

I'm trying to track down a problem of a user of my library xt-audio over here: https://github.com/sjoerdvankreel/xt-audio/issues/26. That project is pretty much like PortAudio, i.e. a single API with multiple backends. When FlexASIO is plugged in as an ASIO backend, i get a crash caused by an abort() over here: https://github.com/dechamps/FlexASIO/blob/57e14e8963b24f6f43f5d28f975b4b0f680e9346/src/flexasio/FlexASIOUtil/portaudio.cpp#L43. Seems like something is already initialized that shouldn't be, but I can't wrap my head around what the root cause is. Any clue as to what may be wrong here? See stacktrace below. This is for a .NET/winforms app, but I doubt if that's the problem.

 	ucrtbase.dll!00007ffc980a286e()	Unknown
>	FlexASIO.dll!flexasio::PortAudioDebugRedirector::PortAudioDebugRedirector(std::function<void __cdecl(std::basic_string_view<char,std::char_traits<char>>)> write) Line 43	C++
 	FlexASIO.dll!flexasio::FlexASIO::FlexASIO(void * sysHandle) Line 322	C++
 	[Inline Frame] FlexASIO.dll!std::_Construct_in_place(flexasio::FlexASIO &) Line 142	C++
 	[Inline Frame] FlexASIO.dll!std::_Optional_construct_base<flexasio::FlexASIO>::_Construct(void * &) Line 125	C++
 	[Inline Frame] FlexASIO.dll!std::optional<flexasio::FlexASIO>::emplace(void * & <_Args_0>) Line 311	C++
 	[Inline Frame] FlexASIO.dll!flexasio::`anonymous-namespace'::CFlexASIO::init::__l2::<lambda>() Line 55	C++
 	FlexASIO.dll!flexasio::`anonymous namespace'::CFlexASIO::Enter<void <lambda>(void)>(std::basic_string_view<char,std::char_traits<char>> context, flexasio::`anonymous-namespace'::CFlexASIO::init::__l2::void <lambda>(void) functor) Line 152	C++
 	FlexASIO.dll!flexasio::`anonymous namespace'::CFlexASIO::init(void * sysHandle) Line 53	C++
 	xt-audio.dll!AsioService::OpenDevice(const char * id, XtDevice * * device) Line 44	C++
 	xt-audio.dll!XtServiceOpenDevice(const XtService * s, const char * id, XtDevice * * device) Line 19	C++
 	[Managed to Native Transition]	
 	Xt.Audio.dll!Xt.XtService.OpenDevice(string id) Line 44	C#
 	Xt.Gui.exe!Xt.XtGui.GetDeviceInfo(Xt.XtService service, Xt.XtDeviceList list, int index, string defaultId) Line 205	C#
 	Xt.Gui.exe!Xt.XtGui.GetDeviceInfos(Xt.XtService service, Xt.XtDeviceList list, string defaultId) Line 220	C#
 	Xt.Gui.exe!Xt.XtGui.OnSystemChanged(object sender, System.EventArgs e) Line 244	C#
 	System.Windows.Forms.dll!System.Windows.Forms.ComboBox.OnSelectedIndexChanged(System.EventArgs e)	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.ComboBox.SelectedIndex.set(int value)	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.ComboBox.RefreshItems()	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.ListControl.SetDataConnection(object newDataSource, System.Windows.Forms.BindingMemberInfo newDisplayMember, bool force)	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.ListControl.DataSource.set(object value)	Unknown
 	Xt.Gui.exe!Xt.XtGui.OnShown(System.EventArgs e) Line 126	C#
 	System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(object obj)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallback(System.Windows.Forms.Control.ThreadMethodEntry tme)	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbacks()	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m)	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc(ref System.Windows.Forms.Message m)	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam)	Unknown
 	[Native to Managed Transition]	
 	user32.dll!00007ffc98ffef75()	Unknown
 	user32.dll!00007ffc98ffe69d()	Unknown
 	System.Windows.Forms.ni.dll!00007ffbdeeea339()	Unknown
 	[Managed to Native Transition]	
 	System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID, int reason, int pvLoopData)	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context)	Unknown
 	System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context)	Unknown
 	Xt.Gui.exe!Xt.XtGui.Main(string[] args) Line 30	C#
 	[Native to Managed Transition]	
 	mscoreei.dll!00007ffc7a7fd6ea()	Unknown
 	mscoree.dll!00007ffc7aaaac42()	Unknown
 	kernel32.dll!00007ffc9a237344()	Unknown
 	ntdll.dll!00007ffc9a4a26b1()	Unknown

sjoerdvankreel avatar May 19 '24 22:05 sjoerdvankreel