-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved crash dumps to the user data directory.
- Loading branch information
Showing
3 changed files
with
66 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,44 @@ | ||
|
||
#include "infrastructure/breakpad.h" | ||
#include "breakpad\exception_handler.h" | ||
#include "infrastructure/format.h" | ||
|
||
// Delegate back to breakpad | ||
static bool HandleCrashCallbackDelegate(const wchar_t* dump_path, | ||
const wchar_t* minidump_id, | ||
void* context, | ||
EXCEPTION_POINTERS* exinfo, | ||
MDRawAssertionInfo* assertion, | ||
bool succeeded) { | ||
auto breakpad = (Breakpad*)context; | ||
|
||
auto msg = fmt::format(L"Sorry! TemplePlus seems to have crashed. A crash report was written to {}\\{}.dmp.\n\n" | ||
L"If you want to report this issue, please make sure to attach this file.", | ||
dump_path, | ||
minidump_id); | ||
|
||
// Now starts the tedious work of reporting on this crash, heh. | ||
MessageBox(NULL, msg.c_str(), L"TemplePlus Crashed - Oops!", MB_OK); | ||
|
||
return false; | ||
} | ||
|
||
Breakpad::Breakpad() | ||
{ | ||
using google_breakpad::ExceptionHandler; | ||
|
||
mHandler.reset(new ExceptionHandler( | ||
L".", | ||
nullptr, | ||
HandleCrashCallbackDelegate, | ||
this, | ||
ExceptionHandler::HANDLER_ALL | ||
)); | ||
|
||
} | ||
|
||
Breakpad::~Breakpad() | ||
{ | ||
} | ||
|
||
#include "infrastructure/breakpad.h" | ||
#include "breakpad\exception_handler.h" | ||
#include "infrastructure/format.h" | ||
|
||
// Delegate back to breakpad | ||
static bool HandleCrashCallbackDelegate(const wchar_t* dump_path, | ||
const wchar_t* minidump_id, | ||
void* context, | ||
EXCEPTION_POINTERS* exinfo, | ||
MDRawAssertionInfo* assertion, | ||
bool succeeded) { | ||
auto breakpad = (Breakpad*)context; | ||
|
||
auto msg = fmt::format(L"Sorry! TemplePlus seems to have crashed. A crash report was written to {}\\{}.dmp.\n\n" | ||
L"If you want to report this issue, please make sure to attach this file.", | ||
dump_path, | ||
minidump_id); | ||
|
||
// Now starts the tedious work of reporting on this crash, heh. | ||
MessageBox(NULL, msg.c_str(), L"TemplePlus Crashed - Oops!", MB_OK); | ||
|
||
return false; | ||
} | ||
|
||
Breakpad::Breakpad(const std::wstring &crashDumpFolder) | ||
{ | ||
using google_breakpad::ExceptionHandler; | ||
|
||
CreateDirectory(crashDumpFolder.c_str(), nullptr); | ||
|
||
mHandler.reset(new ExceptionHandler( | ||
crashDumpFolder.c_str(), | ||
nullptr, | ||
HandleCrashCallbackDelegate, | ||
this, | ||
ExceptionHandler::HANDLER_ALL | ||
)); | ||
|
||
} | ||
|
||
Breakpad::~Breakpad() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
#pragma once | ||
|
||
namespace google_breakpad { | ||
class ExceptionHandler; | ||
} | ||
|
||
#include <memory> | ||
|
||
/* | ||
Abstracts the interface to Google breakpad | ||
*/ | ||
class Breakpad { | ||
public: | ||
Breakpad(); | ||
~Breakpad(); | ||
private: | ||
std::unique_ptr<google_breakpad::ExceptionHandler> mHandler; | ||
}; | ||
#pragma once | ||
|
||
namespace google_breakpad { | ||
class ExceptionHandler; | ||
} | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
/* | ||
Abstracts the interface to Google breakpad | ||
*/ | ||
class Breakpad { | ||
public: | ||
Breakpad(const std::wstring &crashDumpFolder); | ||
~Breakpad(); | ||
private: | ||
std::unique_ptr<google_breakpad::ExceptionHandler> mHandler; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters