'TTF_RenderText_Solid()' segfaults ONLY when compiled against SDL2.0

Hi chaps,

The command TTF_RenderText_Solid() is causing a segmentation fault in my
project. Specifically TTF_RenderText_Solid() causes the problem. I went and
found this piece of minimal code (
http://gameprogrammingtutorials.blogspot.fr/2010/02/sdl-tutorial-series-part-6-displaying.html)
and I’m having the same problem. However if I compile it against SDL
1.2
everything works fine. It’s only when the code is compiled against SDL 2.0
that the segmentation fault occurs.

I’m using a fresh build of SDL 2.0 from the HG. Please could somebody try
compiling this (against SDL 2.0) and telling me what happens for them!

William

I also get a segfault compiling this code with SDL2 and SDL_ttf:

http://codepad.org/m2fZmTqH

Not sure what the deal is, but it can safely be resolved by incrementing
the text struct’s refcount member

text->refcount++;

prior to the call to SDL_FreeSurface().

ChrisOn Sun, Sep 23, 2012 at 6:41 AM, William Dyce wrote:

Hi chaps,

The command TTF_RenderText_Solid() is causing a segmentation fault in my
project. Specifically TTF_RenderText_Solid() causes the problem. I went and
found this piece of minimal code (
http://gameprogrammingtutorials.blogspot.fr/2010/02/sdl-tutorial-series-part-6-displaying.html) and I’m having the same problem. However if I compile it against SDL 1.2
everything works fine. It’s only when the code is compiled against SDL 2.0
that the segmentation fault occurs.

I’m using a fresh build of SDL 2.0 from the HG. Please could somebody try
compiling this (against SDL 2.0) and telling me what happens for them!

William


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org