Prevent 'qmake -query' from bringing up modal message dialog on startup

Temporarily set the ErrorMode so that no Windows error message box will
show up in case qmake fails to run (e.g. because of missing .dll's).
The error mode will automatically be inherited by child processes.

This fixes an issue that actually became virulent by another bug fix
( cbb053068c ).

Task-number: QTCREATORBUG-11962
Change-Id: I5baccf52baee46f3d45b69ea0a13d77e4e113fbd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Kai Koehne
2014-04-04 13:03:40 +02:00
parent 254ecd19b2
commit 453d191d0f
3 changed files with 39 additions and 0 deletions

View File

@@ -172,4 +172,22 @@ QTCREATOR_UTILS_EXPORT bool is64BitWindowsBinary(const QString &binaryIn)
#endif
}
WindowsCrashDialogBlocker::WindowsCrashDialogBlocker()
#ifdef Q_OS_WIN
: silenceErrorMode(SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS),
originalErrorMode(SetErrorMode(silenceErrorMode))
#endif
{
}
WindowsCrashDialogBlocker::~WindowsCrashDialogBlocker()
{
#ifdef Q_OS_WIN
unsigned int errorMode = SetErrorMode(originalErrorMode);
// someone else messed with the error mode in between? Better not touch ...
QTC_ASSERT(errorMode == silenceErrorMode, SetErrorMode(errorMode));
#endif
}
} // namespace Utils