summaryrefslogtreecommitdiff
path: root/vcl/source/app
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-13 22:35:21 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-14 15:59:06 +0100
commitf5af2104fc490b90510e36bbf1d2adec8017c594 (patch)
tree1d9dffcfb65a00d908a346af912f0803d07e6383 /vcl/source/app
parentdef3a581639840d39466327b4853c043bd662437 (diff)
Fix and clean up SalAbort implementations on macOS and Windows
Since "forever", SalAbort has been declared as non-exported in vcl/inc/salinst.hxx and (only) called from Application::Abort (vcl/source/app/svapp.cxx) in Library_vcl. Its various implementations for different platforms have always been scattered across Library_vcl. For Windows, SalAbort was originally implemented in vcl/win/app/salinst.cxx, until 1698debed2993fc5f262aa3ebbdb32fc112ac556 "Implement Windows VCL backend as plugin" introduced an incompatible implementation in vcl/win/app/salplug.cxx (which was added to Library_vcl) and moved the original implementation in vcl/win/app/salinst.cxx from Library_vcl to Library_vclplug_win, where it thus became dead code (and where it now gets removed). For macOS, SalAbort was originally implemented in vcl/osx/salinst.cxx, until 3af4e1a0825c5b11ae4ef58fc411378aab669387 "Implement MacOSX VCL backend as plugin" introduced a different implementation in vcl/osx/salplug.cxx (which was added to Library_vcl) and moved the original implementation in vcl/osx/salinst.cxx from Library_vcl to Library_vclplug_win, where it thus became dead code (and where it now gets removed). (In 0f3be2e19fa408d7069d586ccf04cb3f3eccd6b9 "Unify sal plugin loaders", the--- identical---new implementations in vcl/osx/salinst.cxx and vcl/win/app/salinst.cxx where then consolidated with other---also identical--- implementations in vcl/source/app/salplug.cxx.) For macOS, the original, now removed implementation in vcl/osx/salinst.cxx and the consolidated implementation in vcl/source/app/salplug.cxx only differed in an added CrashReporter::addKeyValue("AbortMessage", rErrorText, CrashReporter::Write); which is presumably harmless to add. But for Windows, the original, now removed implementation in vcl/win/app/salinst.cxx differed substantially from the consolidated implementation in vcl/source/app/salplug.cxx, which is updated here to reflect those differences. The one thing that cannot easily be updated, though, is the //TODO: ImplFreeSalGDI(); call, as ImplFreeSalGDI is defined in Library_vclplug_win. I'll thus leave fixing that TODO for another commit (if calling ImplFreeSalGDI from SalAbort is even necessary, given that it ends in FatalAppExitW anyway)---my gut feeling is that the whole 1698debed2993fc5f262aa3ebbdb32fc112ac556 "Implement Windows VCL backend as plugin" was somewhat misguided. Change-Id: I641a3d7b1bc27ae14c38eb1ec0838bc04e4290d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107666 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source/app')
-rw-r--r--vcl/source/app/salplug.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/vcl/source/app/salplug.cxx b/vcl/source/app/salplug.cxx
index 1868853e93b8..c3e4e666e9d3 100644
--- a/vcl/source/app/salplug.cxx
+++ b/vcl/source/app/salplug.cxx
@@ -36,6 +36,7 @@
#include <unistd.h>
#else
#include <saldatabasic.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <Windows.h>
#endif
@@ -292,17 +293,39 @@ void DestroySalInstance( SalInstance *pInst )
void SalAbort( const OUString& rErrorText, bool bDumpCore )
{
+#if defined _WIN32
+ //TODO: ImplFreeSalGDI();
+#endif
+
if( rErrorText.isEmpty() )
+ {
+#if defined _WIN32
+ // make sure crash reporter is triggered
+ RaiseException( 0, EXCEPTION_NONCONTINUABLE, 0, nullptr );
+ FatalAppExitW( 0, L"Application Error" );
+#else
std::fprintf( stderr, "Application Error\n" );
+#endif
+ }
else
{
CrashReporter::addKeyValue("AbortMessage", rErrorText, CrashReporter::Write);
+#if defined _WIN32
+ // make sure crash reporter is triggered
+ RaiseException( 0, EXCEPTION_NONCONTINUABLE, 0, nullptr );
+ FatalAppExitW( 0, o3tl::toW(rErrorText.getStr()) );
+#else
std::fprintf( stderr, "%s\n", OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
+#endif
}
+#if defined _WIN32
+ (void) bDumpCore;
+#else
if( bDumpCore )
abort();
else
_exit(1);
+#endif
}
const OUString& SalGetDesktopEnvironment()