[SDL] SDL_FreeSurface issue?

Lilith Calbridge lilith at dcccd.edu
Mon Nov 13 13:12:55 PST 2006


Okay.  I was wondering, since you were using a bit of shorthand, if it
didn't track out of the local code.

Lilith

>>> On 11/13/2006 at 3:00 PM, in message
<36e6d5110611131300u421515e9hc1488dba0b5d6826 at mail.gmail.com>, "Armond
Sarkisian" <armond.sarkisian at gmail.com> wrote:
> It does:
> 
> throw domain_error( SDL_GetError( ) );
> 
> On 11/13/06, Lilith Calbridge <lilith at dcccd.edu> wrote:
>>
>> Quick question.  Where you're showing "// throw error" exactly what
does
>> your code do?
>>
>> Lilith
>>
>> >>> On 11/13/2006 at 2:35 PM, in message
>> <36e6d5110611131235u25564d93r9da6fdbfb7d87d98 at mail.gmail.com>,
"Armond
>> Sarkisian" <armond.sarkisian at gmail.com> wrote:
>> > Thanks for your help. I will check to see if I can verifying if
>> LoadIMG( )
>> > returns a NULL.
>> >
>> > Regards,
>> > Armond
>> >
>> > On 11/12/06, andreas <anpa502 at telia.com> wrote:
>> >>
>> >> It should not be any problem to repeatedly allocate/free
surfaces.
>> >> Remember that the method "LoadIMG()" must return NULL in case
image
>> >> loading fails. Otherwise SDL_FreeSurface() may try to free
something
>> that is
>> >> not in use and unexpected results will come.
>> >>
>> >> /a
>> >>
>> >> Armond wrote:
>> >> > Hi everyone,
>> >> >
>> >> > I want to know one thing. If I create a surface, allocate it
and
>> then
>> >> > deallocate it and then once more allocate it again, would that
>> cause a
>> >> problem.
>> >> > I seem to have a problem with the examples below. I thought if
>> you
>> >> deallocate
>> >> > it, all should be well right?
>> >> >
>> >> > ////////////////////////////////////////
>> >> > image = LoadIMG( "ball.bmp" );
>> >> > if( !image ) // throw error
>> >> > SDL_FreeSurface( image );
>> >> > image = NULL; // just in case
>> >> > image = LoadIMG( "ball.bmp" );
>> >> > if( !image ) // throw error
>> >> > ////////////////////////////////////////
>> >> >
>> >>
>> >> _______________________________________________
>> >> SDL mailing list
>> >> SDL at libsdl.org 
>> >> http://www.libsdl.org/mailman/listinfo/sdl 
>> >>
>>
>> _______________________________________________
>> SDL mailing list
>> SDL at libsdl.org 
>> http://www.libsdl.org/mailman/listinfo/sdl 
>>




More information about the SDL mailing list