Commit d14b0f4e authored by Fredrik Orderud's avatar Fredrik Orderud
Browse files

Disable SEH & C++ exception handling by COM for out-of-process controls

[ChangeLog][ActiveQt] Out-of-process ActiveQt controls no longer silently
discards unhandled SEH or C++ exceptions that would otherwise crash the
application. Done to make crashes visible, simplify debugging and enable
automatic crash dump generation through Windows error reporting.

Recommended by Microsoft in
https://msdn.microsoft.com/en-us/library/aa344211.aspx



Change-Id: I76d8872a215551893e2423f412001cb8c404e370
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@qt.io>
Showing with 15 additions and 0 deletions
......@@ -239,6 +239,21 @@ EXTERN_C int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR,
if (run) {
if (SUCCEEDED(CoInitialize(0))) {
#ifdef Q_CC_MINGW
// define GlobalOptions class ID locally for MinGW, since it's missing from the distribution
static const CLSID CLSID_GlobalOptions =
{ 0x0000034B, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
#endif
// Disable C++ & SEH exception handling by the COM runtime for out-of-process COM controls.
// Done to prevent silent crashes and enable crash dump generation.
IGlobalOptions *globalOptions = nullptr;
if (SUCCEEDED(CoCreateInstance(CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER,
IID_IGlobalOptions, reinterpret_cast<void **>(&globalOptions)))) {
globalOptions->Set(COMGLB_EXCEPTION_HANDLING, COMGLB_EXCEPTION_DONOT_HANDLE_ANY);
globalOptions->Release();
globalOptions = nullptr;
}
{
struct Arg {
int c;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment