diff --git a/app/Makefile.am b/app/Makefile.am index bd8dae85d3..5e4872d146 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -99,6 +99,9 @@ libpsapi = -lpsapi # for GimpBacktrace libdbghelp = -ldbghelp +# for I_RpcExceptionFilter() +librpcrt4 = -lrpcrt4 + if HAVE_EXCHNDL exchndl = -lexchndl endif @@ -198,7 +201,8 @@ gimpconsoleldadd = \ $(libm) \ $(libdl) \ $(libpsapi) \ - $(libdbghelp) + $(libdbghelp) \ + $(librpcrt4) gimp_@GIMP_APP_VERSION@_LDFLAGS = \ $(AM_LDFLAGS) \ diff --git a/app/signals.c b/app/signals.c index c242cea840..26ea6831f0 100644 --- a/app/signals.c +++ b/app/signals.c @@ -126,13 +126,27 @@ gimp_init_signal_handlers (gchar **backtrace_file) static LONG WINAPI gimp_sigfatal_handler (PEXCEPTION_POINTERS pExceptionInfo) { - /* Just in case, so that we don't loop or anything similar, just - * re-establish previous handler. - */ - SetUnhandledExceptionFilter (g_prevExceptionFilter); + EXCEPTION_RECORD *er; + int fatal; - /* Now process the exception. */ - gimp_fatal_error ("unhandled exception"); + if (pExceptionInfo == NULL || + pExceptionInfo->ExceptionRecord == NULL) + return EXCEPTION_CONTINUE_SEARCH; + + er = pExceptionInfo->ExceptionRecord; + fatal = I_RpcExceptionFilter (er->ExceptionCode); + + /* IREF() returns EXCEPTION_CONTINUE_SEARCH for fatal exceptions */ + if (fatal == EXCEPTION_CONTINUE_SEARCH) + { + /* Just in case, so that we don't loop or anything similar, just + * re-establish previous handler. + */ + SetUnhandledExceptionFilter (g_prevExceptionFilter); + + /* Now process the exception. */ + gimp_fatal_error ("unhandled exception"); + } if (g_prevExceptionFilter && g_prevExceptionFilter != gimp_sigfatal_handler) return g_prevExceptionFilter (pExceptionInfo);