Only write a dump for the first unhandled exception

This commit is contained in:
Cameron Gutman
2018-09-07 15:45:35 -07:00
parent 391e84e0f4
commit 529ac8041a

View File

@@ -134,8 +134,15 @@ void qtLogToDiskHandler(QtMsgType type, const QMessageLogContext&, const QString
#include <Windows.h>
#include <DbgHelp.h>
static UINT s_HitUnhandledException = 0;
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];
swprintf_s(dmpFileName, L"%ls\\Moonlight-%I64u.dmp",
(PWCHAR)QDir::toNativeSeparators(Path::getLogDir()).utf16(), QDateTime::currentSecsSinceEpoch());