SDL2 Seg Fault on SDL_DetachThread

I’m developing a multithreaded application and SDL_DetachThread randomly gives a seg fault.

Backtrace:
#0 0x6c7b40d8 in SDL_LogCritical () from SDL2.dll
#1 0x0044b45f in std::ostream& std::ostream::_M_insert(unsigned long) ()
#2 0x6c7b9126 in SDL_LogCritical () from SDL2.dll
#3 0x00000001 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Strangely after compiling SDL2 with pthreads instead of using the binaries it stopped seg faulting…