Commit 2e4f0bc9 authored by Alexandre Julliard's avatar Alexandre Julliard

Use sigsetjmp instead of setjmp in Wine internal exception handlers to

make sure the signal mask is restored properly.
parent f9f37beb
......@@ -39,7 +39,7 @@ struct fiber_data
void *stack_base; /* 08 top of fiber stack */
void *stack_limit; /* 0c fiber stack low-water mark */
void *stack_allocation; /* 10 base of the fiber stack allocation */
jmp_buf jmpbuf; /* 14 setjmp buffer (on Windows: CONTEXT) */
sigjmp_buf jmpbuf; /* 14 setjmp buffer (on Windows: CONTEXT) */
DWORD flags; /* fiber flags */
LPFIBER_START_ROUTINE start; /* start routine */
};
......@@ -185,7 +185,7 @@ void WINAPI SwitchToFiber( LPVOID fiber )
/* stack_allocation and stack_base never change */
/* FIXME: should save floating point context if requested in fiber->flags */
if (!setjmp( current_fiber->jmpbuf ))
if (!sigsetjmp( current_fiber->jmpbuf, 1 ))
{
NtCurrentTeb()->Tib.u.FiberData = new_fiber;
NtCurrentTeb()->Tib.ExceptionList = new_fiber->except;
......@@ -195,6 +195,6 @@ void WINAPI SwitchToFiber( LPVOID fiber )
if (new_fiber->start) /* first time */
wine_switch_to_stack( start_fiber, new_fiber, new_fiber->stack_base );
else
longjmp( new_fiber->jmpbuf, 1 );
siglongjmp( new_fiber->jmpbuf, 1 );
}
}
......@@ -394,7 +394,7 @@ DWORD __wine_exception_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION
RtlUnwind( frame, 0, record, 0 );
__wine_pop_frame( frame );
longjmp( wine_frame->jmp, 1 );
siglongjmp( wine_frame->jmp, 1 );
}
......
......@@ -89,7 +89,7 @@
__f.frame.Handler = __wine_exception_handler; \
__f.u.filter = (func); \
__wine_push_frame( &__f.frame ); \
if (setjmp( __f.jmp)) { \
if (sigsetjmp( __f.jmp, 1 )) { \
const __WINE_FRAME * const __eptr WINE_UNUSED = &__f; \
do {
......@@ -135,7 +135,7 @@ typedef struct __tagWINE_FRAME
/* finally data */
__WINE_FINALLY finally_func;
} u;
jmp_buf jmp;
sigjmp_buf jmp;
/* hack to make GetExceptionCode() work in handler */
DWORD ExceptionCode;
const struct __tagWINE_FRAME *ExceptionRecord;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment