aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f4f2b78..f6a5b17 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -148,26 +148,20 @@ int main(int argc, char **argv)
// set this, otherwise the webview becomes black when using a stylesheet
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true);
-#ifdef CONFIG_USEBREAKPAD
- const std::string crashpath = config->value<std::string>("browser.crash.path").value_or("/tmp");
- assert(!crashpath.empty());
-
- CrashHandler::BreakpadContext ctx;
- google_breakpad::MinidumpDescriptor descriptor(crashpath.c_str());
-
- const auto crashHandler = config->value<std::string>("browser.crash.handler");
- if(crashHandler) {
- const int length = crashHandler.value().length() + 1;
- ctx.handler = new char[length];
- crashHandler.value().copy(ctx.handler, length - 1);
- ctx.handler[length - 1] = '\0';
- }
-
- // minidump descriptor, filter callback, minidump callback, callback_context, install handler, server_fd
- google_breakpad::ExceptionHandler eh(descriptor, nullptr, CrashHandler::dumpCallback, &ctx, true, -1);
+ {
+ Configuration conf;
+ if(conf.value<bool>("usebreakpad").value()) {
+ CrashHandler::Context ctx(
+ conf.value<std::string>("path.crashdump").value(),
+ conf.value<std::string>("path.crashhandler").value());
- spdlog::debug("Installed breakpad exception handler (path {})", crashpath);
-#endif // CONFIG_USEBREAKPAD
+ if(CrashHandler::install_handler(ctx)) {
+ spdlog::info("Installed breakpad crash handler: {}", ctx.dumppath);
+ } else {
+ spdlog::warn("Failed to install breakpad crash handler: {}", ctx.dumppath);
+ }
+ }
+ }
const auto profile = []() {
Configuration c;