From 250806252e526889820549e6ac13ce259a340ebd Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 24 Apr 2018 15:09:30 -0700 Subject: [PATCH] Don't use unique_ptr to store CrashpadClient --- interface/src/Crashpad.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/interface/src/Crashpad.cpp b/interface/src/Crashpad.cpp index 27b6f4b937..45f1d0778f 100644 --- a/interface/src/Crashpad.cpp +++ b/interface/src/Crashpad.cpp @@ -39,16 +39,17 @@ static const std::string BACKTRACE_TOKEN { CMAKE_BACKTRACE_TOKEN }; extern QString qAppFileName(); +CrashpadClient* client { nullptr }; std::mutex annotationMutex; crashpad::SimpleStringDictionary* crashpadAnnotations { nullptr }; - -std::unique_ptr client; - LONG WINAPI vectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) { + if (!client) { + return EXCEPTION_CONTINUE_SEARCH; + } + if (pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_HEAP_CORRUPTION || pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_STACK_BUFFER_OVERRUN) { - assert(client); client->DumpAndCrash(pExceptionInfo); } @@ -60,7 +61,8 @@ bool startCrashHandler() { return false; } - client.reset(new CrashpadClient()); + assert(!client); + client = new CrashpadClient(); std::vector arguments; std::map annotations;