[Mono-dev] Strange Crash with mono-3.2.3 + Qt-5.2.1

Robert Jordan robertj at gmx.net
Mon Feb 17 09:23:14 UTC 2014


On 14.02.2014 21:35, Frank Fuchs wrote:
> I first noticed with my Qt based application and a 64 bit build of
> mono-3.2.3. However, I confirmed the very same problem with the offical
> binary releases fo Qt-5.2.1 (mingw) and mono-3.2.3.
>
> An application which embedds mono and initializes the runtime (which passes
> without problems) like
>
> mono_set_dirs(libs,etc);
> domain = mono_jit_init ("test");	
>
> will crash upon opening a Qt file dialog. gdb reports the crash to occur in
> rpcrt4.dll RpcCompleteAndFree (32 bit) and RpcEpRegisterNoReplaceW (64bit).
> I'm not sure if this is any helpfull.
>
> If there's something more you need to trace this problem, let me know how I
> can help.

This looks like a COM problem to me (rpcrt4.dll does COM marshaling).

Odds are that Qt's file dialog is needing an STA (single thread
apartment) because it's somehow interacting with the Windows shell.

By default, Mono (and MS.NET) is initializing COM for multithreaded
concurrency (MTA) which may interact badly with STA COM objects
used by the Windows shell.

You may want to try to add an [STAThread] attribute to your Main
C# method.

Robert




More information about the Mono-devel-list mailing list