Newbie needs help!

Hello everyone,

I am a newbie on SDL and I need some help.
I’m using the SDL_LoadBMP function to load
some .bmp files to use them as textures or
OpenGL. When I run my program, it loads the
first file without any problems but when it
tries to load the second one SDL causes a
Segmentation fault( “Segmentation fault (SDL
Parachute Deployed)”).
My code looks like this:

SDL_Surface *pImage;
pImage = SDL_LoadBMP( filename );
.
. here comes the stuff like glGenTextures, etc…
.
free( pImage->pixels );
free( pImage );

I’m doing this for all the files that need to be loaded.
I have initialized SDL by calling “SDL_Init( SDL_INIT_VIDEO );”

I’m using SDL 1.2 on SuSE Linux 7.1

Is there anyone, who can help me to fix this problem???

Thanx in advance…Michael

Hello.

free( pImage->pixels );
free( pImage );

SDL_FreeSurface() is used for freeing surfaces.

JakobOn Thu, Jan 03, 2002 at 08:53:34PM +0100, Michael Gr?tzner wrote:

People that can’t find something to live for always seem to find something to
die for. The problem is, they usually want the rest of us to die for it too.
-/usr/games/fortune

Don’t free()… use SDL_FreeSurface()> ----- Original Message -----

From: michael_gruetzner@gmx.de (Michael Gruetzner)
To:
Sent: Thursday, January 03, 2002 1:53 PM
Subject: [SDL] Newbie needs help!!!

Hello everyone,

I am a newbie on SDL and I need some help.
I’m using the SDL_LoadBMP function to load
some .bmp files to use them as textures or
OpenGL. When I run my program, it loads the
first file without any problems but when it
tries to load the second one SDL causes a
Segmentation fault( “Segmentation fault (SDL
Parachute Deployed)”).
My code looks like this:

SDL_Surface *pImage;
pImage = SDL_LoadBMP( filename );
.
. here comes the stuff like glGenTextures, etc…
.
free( pImage->pixels );
free( pImage );

I’m doing this for all the files that need to be loaded.
I have initialized SDL by calling “SDL_Init( SDL_INIT_VIDEO );”

I’m using SDL 1.2 on SuSE Linux 7.1

Is there anyone, who can help me to fix this problem???

Thanx in advance…Michael


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl