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@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
Markus Mohrhard
2016-05-16 02:52:29 +02:00
parent df52355607
commit e8c1727b37

View File

@@ -18,6 +18,7 @@
*/ */
#include <sal/config.h> #include <sal/config.h>
#include <config_features.h>
#include <signalshared.hxx> #include <signalshared.hxx>
@@ -42,11 +43,13 @@
namespace namespace
{ {
long WINAPI signalHandlerFunction(LPEXCEPTION_POINTERS lpEP); long WINAPI signalHandlerFunction(LPEXCEPTION_POINTERS lpEP);
LPTOP_LEVEL_EXCEPTION_FILTER pPreviousHandler = nullptr;
} }
bool onInitSignal() bool onInitSignal()
{ {
SetUnhandledExceptionFilter(signalHandlerFunction); pPreviousHandler = SetUnhandledExceptionFilter(signalHandlerFunction);
HMODULE hFaultRep = LoadLibrary( "faultrep.dll" ); HMODULE hFaultRep = LoadLibrary( "faultrep.dll" );
if ( hFaultRep ) if ( hFaultRep )
@@ -62,7 +65,7 @@ bool onInitSignal()
bool onDeInitSignal() bool onDeInitSignal()
{ {
SetUnhandledExceptionFilter(nullptr); SetUnhandledExceptionFilter(pPreviousHandler);
return false; return false;
} }
@@ -74,6 +77,13 @@ namespace
long WINAPI signalHandlerFunction(LPEXCEPTION_POINTERS lpEP) 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; static bool bNested = false;
oslSignalInfo info; oslSignalInfo info;