[SDL] SDL_FreeSurface issue?

Armond Sarkisian armond.sarkisian at gmail.com
Mon Nov 13 13:00:03 PST 2006


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061113/bd84d09e/attachment.htm>


More information about the SDL mailing list