diff options
author | Juergen Funk <juergen.funk_ml@cib.de> | 2019-09-25 13:49:26 +0200 |
---|---|---|
committer | Juergen Funk (CIB) <juergen.funk_ml@cib.de> | 2019-10-02 07:10:50 +0200 |
commit | 8fe03eef707561bb0b9e1655292619ec3cd347f5 (patch) | |
tree | 8cfd6d8f86f0b82e93c42bef9d96f9221d019ae6 /desktop/source/app/sofficemain.cxx | |
parent | d09dc224977c498356ab76738afe03136c98fabe (diff) |
Refactoring of the class CrashReporter
- remove double code
- using of all the methode of the CrashReporter-Class
- all methode only active when crash-dump enable
except the addKeyValue
With this change the handling for the patch
tdf#127711 A runtime-switch for the MiniCrashDump
would be simpler
Change-Id: I339b3b8e06f7fc2cd3c0d34ece112a6fd352913a
Reviewed-on: https://gerrit.libreoffice.org/79272
Tested-by: Jenkins
Reviewed-by: Juergen Funk (CIB) <juergen.funk_ml@cib.de>
Diffstat (limited to 'desktop/source/app/sofficemain.cxx')
-rw-r--r-- | desktop/source/app/sofficemain.cxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index 719446e03a81..70d396d232b6 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -45,7 +45,6 @@ #include <unotools/mediadescriptor.hxx> #if HAVE_FEATURE_BREAKPAD -#include <fstream> #include <desktop/crashreport.hxx> #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID @@ -81,11 +80,9 @@ #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* /*context*/, bool succeeded) { - std::string ini_path = CrashReporter::getIniFileName(); - std::ofstream minidump_file(ini_path, std::ios_base::app); - minidump_file << "DumpFile=" << descriptor.path() << "\n"; - minidump_file.close(); + CrashReporter::addKeyValue("DumpFile", OStringToOUString(descriptor.path(), RTL_TEXTENCODING_UTF8), CrashReporter::Write); SAL_WARN("desktop", "minidump generated: " << descriptor.path()); + return succeeded; } #elif defined WNT @@ -94,17 +91,14 @@ static bool dumpCallback(const wchar_t* path, const wchar_t* id, MDRawAssertionInfo* /*assertion*/, bool succeeded) { - std::string ini_path = CrashReporter::getIniFileName(); - std::ofstream minidump_file(ini_path, std::ios_base::app); // TODO: moggi: can we avoid this conversion #ifdef _MSC_VER #pragma warning (disable: 4996) #endif std::wstring_convert<std::codecvt_utf8<wchar_t>> conv1; std::string aPath = conv1.to_bytes(std::wstring(path)) + conv1.to_bytes(std::wstring(id)) + ".dmp"; - minidump_file << "DumpFile=" << aPath << "\n"; - minidump_file << "GDIHandles=" << ::GetGuiResources (::GetCurrentProcess(), GR_GDIOBJECTS) << "\n"; - minidump_file.close(); + CrashReporter::addKeyValue("DumpFile", OStringToOUString(aPath.c_str(), RTL_TEXTENCODING_UTF8), CrashReporter::AddItem); + CrashReporter::addKeyValue("GDIHandles", OUString::number(::GetGuiResources (::GetCurrentProcess(), GR_GDIOBJECTS)), CrashReporter::Write); SAL_WARN("desktop", "minidump generated: " << aPath); return succeeded; } |