SDL2 over 2.0.5 crash on Windows 7


I’m using a Atari ST emulator that uses SDL2. On Windows 7 (not 8 nor 10) SDL 2.0.6 and 2.0.7 crash the emulator, while 2.0.5 works fine. Normally I use the SDL2.dll that I compile myself, but I did try with the dll that is available on and it happens there as well. What can I do to help to get this fixed?

We need to narrow it down where the crash happens. Can you attach a debugger and check?

If you don’t have time for this, can you describe the steps that would be needed so we could reproduce that ourselves?

I can do both!
The files I produced (I’ve setup a build system for the emulator) is located here: - the zip file contains everything you need to start it up. As you’ll see, the emulator will crash only on Windows 7.
The SDL2.dll included is stripped, so there’s no debug symbols there. If you replace SDL2.dll with the one from (or the 64bit version, if you run try that), the emulator will start.

I compiled a SDL2.dll that do have debug symbols and IF I used gdb correctly, this is what you are after:
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x6c9858ee in GL_UpdateViewport (renderer=0x57bba28)
at /home/solskogen/mingw-w64-builder/trunk/lib/sdl2/src/render/opengl/SDL_re
#2 GL_ActivateRenderer (renderer=0x57bba28)
at /home/solskogen/mingw-w64-builder/trunk/lib/sdl2/src/render/opengl/SDL_re
#3 0x6c987d38 in GL_DestroyRenderer (renderer=0x57bba28)
at /home/solskogen/mingw-w64-builder/trunk/lib/sdl2/src/render/opengl/SDL_re
#4 0x6c988858 in GL_CreateRenderer (window=0x3dcdb0, flags=0)
at /home/solskogen/mingw-w64-builder/trunk/lib/sdl2/src/render/opengl/SDL_re
#5 0x6c970d8f in SDL_CreateRenderer_REAL (window=0x3dcdb0, index=2, flags=0)
at /home/solskogen/mingw-w64-builder/trunk/lib/sdl2/src/render/SDL_render.c:
#6 0x0043b5ea in Screen_SetSDLVideoSize (width=width@entry=832,
height=height@entry=588, bitdepth=32,
at /home/hatari/hatari-builder2/hatari/src/screen.c:403
#7 0x0043baf3 in Screen_SetSTResolution (
at /home/hatari/hatari-builder2/hatari/src/screen.c:602
#8 0x0043c16e in Screen_ChangeResolution (
at /home/hatari/hatari-builder2/hatari/src/screen.c:654
#9 0x0043c2a0 in Screen_Init ()
at /home/hatari/hatari-builder2/hatari/src/screen.c:704
#10 0x00431519 in Main_Init ()
at /home/hatari/hatari-builder2/hatari/src/main.c:706
#11 SDL_main (argc=argc@entry=1, argv=argv@entry=0x3d1428)
at /home/hatari/hatari-builder2/hatari/src/main.c:892
#12 0x00b49604 in main_utf8 (argv=0x3d1428, argc=1)
at /home/solskogen/mingw-w64-builder/trunk/lib/sdl2/src/main/windows/SDL_win
#13 main_getcmdline ()
at /home/solskogen/mingw-w64-builder/trunk/lib/sdl2/src/main/windows/SDL_win
#14 WinMain@16 (hInst=0x400000, hPrev=hPrev@entry=0x0,
szCmdLine=0x41225c7 “”, sw=10)
at /home/solskogen/mingw-w64-builder/trunk/lib/sdl2/src/main/windows/SDL_win
#15 0x00b849fd in main (flags=1, cmdline=0x3d13e8, inst=0x3d1698)
at /home/solskogen/mingw-w64-builder/trunk/lib/mingw-w64/mingw-w64-crt/crt/c

Oh, I think this is the issue where SDL tries to reset the viewport when it didn’t properly load the OpenGL functions and it makes a call to 0x00000000.

Do you have an OpenGL driver on that Windows system? This should only happen if you don’t have OpenGL 1.4 or higher. Windows falls back to GDI Generic, which is a OpenGL 1.1 software renderer.

This is just a guess, though.

Perhaps. I got this report from somebody else, and since I do not have a physical Windows 7 machine, I had to install Windows 7 on VirtualBox.

If it’s that, I’ll try to finally update my (now very outdated) patch that happened to fix this. Just need to finish something else first.

Thanks! I’ll try with the mercurial version in a couple of weeks then.