Receive --- Fatal signal: Segmentation Fault (SDL Parachute Deployed) ---

Hi everybody,
I have a little problem.

For close my SDL application, just push the ‘q’ key, but after I receive
this error in my shell

Fatal signal: Segmentation Fault (SDL Parachute Deployed)

Why?

The lines code for this event are:

 67   while ( SDL_PollEvent( &event) )$
 68   {$
 69     switch ( event.type )$
 70     {$
 71       case SDL_KEYDOWN:$
 72         switch ( event.key.keysym.sym )$
 73         {$


228 case SDLK_q:$
229 return (1);$
230 break;$

the return give 1 to infinite while loop into main.cpp, this exit to
loop and close the application

 10   while ( !quit )$
 11   {$
 12     main.DrawObject();$
 13     quit = main.Keyboard();$
 14   }$
 15 $
 16   return (0);$
 17 }$

I waiting your reply

When you’re initializing SDL, do you say atexit( SDL_Quit );?

If not, you’re leaving the program without shutting down SDL. Which you
shouldn’t do :slight_smile:

Either call SDL_Quit() before you return 0;
or add an atexit when you init SDL.On Fri, 2003-09-12 at 15:56, NighTiger wrote:

Hi everybody,
I have a little problem.

For close my SDL application, just push the ‘q’ key, but after I receive
this error in my shell

Fatal signal: Segmentation Fault (SDL Parachute Deployed)

Why?

The lines code for this event are:

 67   while ( SDL_PollEvent( &event) )$
 68   {$
 69     switch ( event.type )$
 70     {$
 71       case SDL_KEYDOWN:$
 72         switch ( event.key.keysym.sym )$
 73         {$


228 case SDLK_q:$
229 return (1);$
230 break;$

the return give 1 to infinite while loop into main.cpp, this exit to
loop and close the application

 10   while ( !quit )$
 11   {$
 12     main.DrawObject();$
 13     quit = main.Keyboard();$
 14   }$
 15 $
 16   return (0);$
 17 }$

I waiting your reply


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


Jimmy <@Jimmy>
Jimmy’s World.org
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030912/282f9253/attachment.pgp