Only write a dump for the first unhandled exception
This commit is contained in:
parent
391e84e0f4
commit
529ac8041a
1 changed files with 7 additions and 0 deletions
|
|
@ -134,8 +134,15 @@ void qtLogToDiskHandler(QtMsgType type, const QMessageLogContext&, const QString
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <DbgHelp.h>
|
#include <DbgHelp.h>
|
||||||
|
|
||||||
|
static UINT s_HitUnhandledException = 0;
|
||||||
|
|
||||||
LONG WINAPI UnhandledExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
LONG WINAPI UnhandledExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
||||||
{
|
{
|
||||||
|
// Only write a dump for the first unhandled exception
|
||||||
|
if (InterlockedCompareExchange(&s_HitUnhandledException, 1, 0) != 0) {
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
WCHAR dmpFileName[MAX_PATH];
|
WCHAR dmpFileName[MAX_PATH];
|
||||||
swprintf_s(dmpFileName, L"%ls\\Moonlight-%I64u.dmp",
|
swprintf_s(dmpFileName, L"%ls\\Moonlight-%I64u.dmp",
|
||||||
(PWCHAR)QDir::toNativeSeparators(Path::getLogDir()).utf16(), QDateTime::currentSecsSinceEpoch());
|
(PWCHAR)QDir::toNativeSeparators(Path::getLogDir()).utf16(), QDateTime::currentSecsSinceEpoch());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue