The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Crash on SDL_Init
Christopher Gautier
Guest

Hi all,

On my netbook, a program reduced to SDL_Init(SDL_INIT_EVERYTHING) crashes
with the following valgrind stacktrace:

==6552== Invalid read of size 4
==6552== at 0x4541BCF: XGetICValues (in /usr/lib/libX11.so.6.3.0)
==6552== by 0x40CBA6B: X11_CreateWindow (SDL_x11window.c:559)
==6552== by 0x40C2170: SDL_CreateWindow (SDL_video.c:1186)
==6552== by 0x40C1FC4: SDL_VideoInit (SDL_video.c:169)
==6552== by 0x4037E53: SDL_InitSubSystem (SDL.c:55)
==6552== by 0x4268E45: (below main) (libc-start.c:228)
==6552== Address 0x4 is not stack'd, malloc'd or (recently) free'd

(with today's hg repository)

The immediate cause is that ((SDL_WindowData *) window->driverdata)->ic is
NULL (but not driverdata).

ic seems to be initialized only if SDL_X11_HAVE_UTF8; protecting the call to
pXGetICValues() with a "if(SDL_X11_HAVE_UTF8)" fixed the issue.

Best,
Chris
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Crash on SDL_Init
Ryan C. Gordon
Guest

Quote:
ic seems to be initialized only if SDL_X11_HAVE_UTF8;

Interesting...which X server didn't have UTF-8 support?

(This crash should be fixed in revision control now, thanks!)

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Crash on SDL_Init
Christopher Gautier
Guest

Quote:
Quote:
ic seems to be initialized only if SDL_X11_HAVE_UTF8;
Interesting...which X server didn't have UTF-8 support?

Actually, I'm compiling without SDL_VIDEO_DRIVER_X11_DYNAMIC (i.e.
--disable-x11-shared). Apparently in that case, SDL_X11_HAVE_UTF8 is
initialized via a #define to 0 (in SDL_x11dyn.c), but is not modified later,
hence the earlier crash (which is now fixed, thank you!)

It seems to me that SDL_X11_HAVE_UTF8 should be conditionally set to 1 in the
non-dynamic case.

Chris
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Crash on SDL_Init
Christopher Gautier
Guest

Hello,

On my netbook, a program reduced to SDL_Init(SDL_INIT_EVERYTHING) crashes
with the following valgrind stacktrace:

==6552== Invalid read of size 4
==6552== at 0x4541BCF: XGetICValues (in /usr/lib/libX11.so.6.3.0)
==6552== by 0x40CBA6B: X11_CreateWindow (SDL_x11window.c:559)
==6552== by 0x40C2170: SDL_CreateWindow (SDL_video.c:1186)
==6552== by 0x40C1FC4: SDL_VideoInit (SDL_video.c:169)
==6552== by 0x4037E53: SDL_InitSubSystem (SDL.c:55)
==6552== by 0x4268E45: (below main) (libc-start.c:228)
==6552== Address 0x4 is not stack'd, malloc'd or (recently) free'd

The immediate cause is that ((SDL_WindowData *) window->driverdata)->ic is NULL
(but not driverdata).

ic seems to be initialized only if SDL_X11_HAVE_UTF8; maybe another
SDL_X11_HAVE_UTF8 is needed here.

I compiled from today's hg repository.

Chris
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org