From 8fe03eef707561bb0b9e1655292619ec3cd347f5 Mon Sep 17 00:00:00 2001 From: Juergen Funk Date: Wed, 25 Sep 2019 13:49:26 +0200 Subject: 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) --- desktop/source/app/sofficemain.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'desktop/source/app/sofficemain.cxx') 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 #if HAVE_FEATURE_BREAKPAD -#include #include #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> 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; } -- cgit