diff options
author | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2024-12-19 11:20:56 +0100 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2024-12-19 11:20:56 +0100 |
commit | 6b34e49391094bd1a0d5b2d6dfad42b26d0dabc8 (patch) | |
tree | d44b7cdb01772e9ae40dec7562409f088b7b9505 | |
parent | 6cdcaefe94597df028f935f08b2079ecbba020ec (diff) |
Optionally disable crashreporter UI
cib_contract49d-24.8.4.2.M3feature/cib_contract49d
Change-Id: I0eea6267bbd3082e185dc0be3ff0371aabc0c101
-rw-r--r-- | desktop/source/app/app.cxx | 3 | ||||
-rw-r--r-- | desktop/source/app/crashreport.cxx | 26 |
2 files changed, 25 insertions, 4 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index d30bd0e582f3..0cd3b2b40f48 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2031,7 +2031,8 @@ void Desktop::OpenClients() #endif #if HAVE_FEATURE_BREAKPAD - if (officecfg::Office::Common::Misc::CrashReport::get() && CrashReporter::crashReportInfoExists()) + if (CrashReporter::IsDumpEnable() && + officecfg::Office::Common::Misc::CrashReport::get() && CrashReporter::crashReportInfoExists()) handleCrashReport(); #endif diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx index 18db12d07b38..b8d3a9400b29 100644 --- a/desktop/source/app/crashreport.cxx +++ b/desktop/source/app/crashreport.cxx @@ -131,9 +131,21 @@ void CrashReporter::writeCommonInfo() ucbhelper::InternetProxyDecider proxy_decider(::comphelper::getProcessComponentContext()); static constexpr OUString protocol = u"https"_ustr; - static constexpr OUString url = u"crashreport.libreoffice.org"_ustr; const sal_Int32 port = 443; + // read configuration item 'CrashDumpUrl' + OUString url; + rtl::Bootstrap::get("CrashDumpUrl", url); + if (url.isEmpty()) + { + // no url in config, bail out, but still set proper crash + // directory for local dump generation (in case + // CrashDumpEnable is on + updateMinidumpLocation(); + mbInit = false; + return; + } + const OUString proxy_server = proxy_decider.getProxy(protocol, url, port); // save the new Keys @@ -269,6 +281,12 @@ void CrashReporter::removeExceptionHandler() bool CrashReporter::IsDumpEnable() { + static bool bConfigRead = false; + static bool bEnable = true; // default, always on + + if (bConfigRead) + return bEnable; + auto const env = std::getenv("CRASH_DUMP_ENABLE"); if (env != nullptr && env[0] != '\0') { return true; @@ -277,9 +295,11 @@ bool CrashReporter::IsDumpEnable() OUString sToken; if (rtl::Bootstrap::get("CrashDumpEnable", sToken)) { - return sToken.toBoolean(); + bEnable = sToken.toBoolean(); } - return true; // default, always on + + bConfigRead = true; + return bEnable; } |