Issue #2794 - Gimp crash just on File Open and Edit Preferences

As suggested by LRN, change gimp_sigfatal_handler() on Windows to
dstinguish between fatal and non-fatal exceptions so we don't abort on
each minor hickup.
This commit is contained in:
Michael Natterer 2019-05-28 11:55:59 +02:00
parent 4ac4820a54
commit 679fd5f231
2 changed files with 25 additions and 7 deletions

View File

@ -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) \

View File

@ -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);