Access violation with SDL_RenderText

mike vertex at gmx.at
Fri Oct 27 09:30:17 PDT 2006


Hi!

I'm doing some GUI stuff with SDL and I got those constantly changing  
values that I need to draw on the screen. The idea (if you don't know SDL)  
is that you create a new surface (a bitmap) every time the value changes,  
draw it to the screen and then delete the bitmap after drawing.

In pseudo code:

' surface = RenderText(value); // <- This function returns a pointer to a  
new surface (a struct)
' DrawSurface(surface);
' UpdateScreen();
' FreeSurface(surface);

Now that works so far. The problem is that my program crashes after some  
time - about two minutes when I'm constantly moving the mouse, forcing the  
GUI to redraw (access violation in the RenderText() line). Memory usage  
goes up a little, about 4k every 10-15 seconds, which makes me a bit  
suspicious, since I'm not newing anything at all, besides the surface I  
get returned from RenderText() which I delete anyway, using the  
FreeSurface() function.

So my question: Has anybody of you had this problem? Or any ideas? Could  
that be a GC issue? Maybe the GC wants to free something that doesn't  
exist anymore? I have no idea what's going wrong, so if someone could give  
me a hint I'd be very glad.

-Mike

-- 
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/



More information about the Digitalmars-d-learn mailing list