diff -r 84d89d60908f src/thread/windows/SDL_systhread.c --- a/src/thread/windows/SDL_systhread.c Sat Sep 07 13:57:20 2013 -0400 +++ b/src/thread/windows/SDL_systhread.c Wed Sep 11 18:37:27 2013 +0200 @@ -157,10 +157,10 @@ } THREADNAME_INFO; #pragma pack(pop) -static EXCEPTION_DISPOSITION -ignore_exception(void *a, void *b, void *c, void *d) +static LONG WINAPI ignore_exception(EXCEPTION_POINTERS * a) { - return ExceptionContinueExecution; + printf("Ignoring\n"); + return EXCEPTION_CONTINUE_EXECUTION; } #endif @@ -168,12 +168,11 @@ SDL_SYS_SetupThread(const char *name) { if (name != NULL) { - #if (defined(_MSC_VER) && defined(_M_IX86)) + #ifdef _MSC_VER /* This magic tells the debugger to name a thread if it's listening. - The inline asm sets up SEH (__try/__except) without C runtime - support. See Microsoft Systems Journal, January 1997: - http://www.microsoft.com/msj/0197/exception/exception.aspx */ - INT_PTR handler = (INT_PTR) ignore_exception; + It uses the Windows C API instead of the runtime-library specific + exception handling extension. */ + LPTOP_LEVEL_EXCEPTION_FILTER prev; THREADNAME_INFO inf; inf.dwType = 0x1000; @@ -181,20 +180,12 @@ inf.dwThreadID = (DWORD) -1; inf.dwFlags = 0; - __asm { /* set up SEH */ - push handler - push fs:[0] - mov fs:[0],esp - } + prev = SetUnhandledExceptionFilter(ignore_exception); /* The program itself should ignore this bogus exception. */ - RaiseException(0x406D1388, 0, sizeof(inf)/sizeof(DWORD), (DWORD*)&inf); + RaiseException(0x406D1388, 0, sizeof(inf)/sizeof(DWORD), (ULONG_PTR*)&inf); - __asm { /* tear down SEH. */ - mov eax,[esp] - mov fs:[0], eax - add esp, 8 - } + SetUnhandledExceptionFilter(prev); #endif } }