[Libreoffice-commits] core.git: sal/osl

Markus Mohrhard markus.mohrhard at googlemail.com
Mon May 16 03:22:40 UTC 2016


 sal/osl/w32/signal.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit e8c1727b37c7cdaec20407a38aeceec853b15d32
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon May 16 02:52:29 2016 +0200

    get breakpad signal handler working on windows
    
    The LibreOffice signal handler overwrites the breakpad signal handler.
    Just store the old handler and call that handler before we do any work
    in our own handler.
    
    Our own handler implementation is just insane as we are even trying to
    take the SolarMutex which can easily deadlock.
    
    Change-Id: I2401bba18701115561d00c7fc11138ead2a48205
    Reviewed-on: https://gerrit.libreoffice.org/25022
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sal/osl/w32/signal.cxx b/sal/osl/w32/signal.cxx
index fb0eee05..071df17 100644
--- a/sal/osl/w32/signal.cxx
+++ b/sal/osl/w32/signal.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <sal/config.h>
+#include <config_features.h>
 
 #include <signalshared.hxx>
 
@@ -42,11 +43,13 @@
 namespace
 {
 long WINAPI signalHandlerFunction(LPEXCEPTION_POINTERS lpEP);
+
+LPTOP_LEVEL_EXCEPTION_FILTER pPreviousHandler = nullptr;
 }
 
 bool onInitSignal()
 {
-    SetUnhandledExceptionFilter(signalHandlerFunction);
+    pPreviousHandler = SetUnhandledExceptionFilter(signalHandlerFunction);
 
     HMODULE hFaultRep = LoadLibrary( "faultrep.dll" );
     if ( hFaultRep )
@@ -62,7 +65,7 @@ bool onInitSignal()
 
 bool onDeInitSignal()
 {
-    SetUnhandledExceptionFilter(nullptr);
+    SetUnhandledExceptionFilter(pPreviousHandler);
 
     return false;
 }
@@ -74,6 +77,13 @@ namespace
 
 long WINAPI signalHandlerFunction(LPEXCEPTION_POINTERS lpEP)
 {
+#if HAVE_FEATURE_BREAKPAD
+    // we should make sure to call the breakpad handler as
+    // first step when we hit a problem
+    if (pPreviousHandler)
+        pPreviousHandler(lpEP);
+#endif
+
     static bool bNested = false;
 
     oslSignalInfo info;


More information about the Libreoffice-commits mailing list