Problem with thread naming exception in windows

Hi,

We am moving towards release of our first SDL2 project but I have run into a problem with the windows release build. The release build runs under a debugger but fails to run normally. I checked the log files and an exception is thrown - google tells me this is not a real exception but a bit of magic to allow applications to name threads for debugging purposes. Applications should be ignoring this exception - but unfortunately mine isn’t.

I can work around the problem by removing all the code from SDL_SYS_SetupThread() with #if(0). If I do this and rebuild SDL2.dll, my application runs fine, but obviously I’d rather not release with a custom version of SDL2. Is there a better solution to this problem?

I am running Windows 7 64 bit, Visual Studio Express 2012, building a 32 bit application.

Regards

Tony

Tony Park wrote:

I checked the log files and an exception is thrown - google tells me this is
not a real exception but a bit of magic to allow applications to name
threads for debugging purposes. Applications should be ignoring this
exception - but unfortunately mine isn’t.
I can work around the problem by removing all the code from
SDL_SYS_SetupThread() with #if(0). If I do this and rebuild SDL2.dll,
my application runs fine, but obviously I’d rather not release with a
custom version of SDL2. Is there a better solution to this problem?

The current SDL code doesn’t add its exception handler to the safe SEH
list and Windows will terminate the application if it encounters it.
You can work around this by building SDL with the /SAFESEH:NO linker
flag. Isn’t really comforting when disabling a security feature is
necessary to get it to work so disabling the code for the thread names
is probably better.

https://bugzilla.libsdl.org/show_bug.cgi?id=2089