This code worked for me when I used Suse 5.3, but after I installed Redhat 5.2 yesterday it crashes. At the pollevent line it says ‘Fatal signal: Segmentation Fault (SDL Parachute Deployed)’
When I comment out the pollevent-block the program doesn’t stop when I press ESC. As I said before it worked just a few days ago with suse.
Of course the program is bigger than this, but I don’t think it’s relevant to this problem. The example programs that uses events crashes too. I’m using SDL 0.9.8, and I tried to recompile SDL on the Redhat system, but it didn’t help.
void loop()
{
int exit = 0;
SDL_Event event;
Uint8 *keystate;
while (!exit)
{
keystate = SDL_GetKeyState(NULL);
if (keystate[SDLK_ESCAPE])
{
fprintf(stderr,“Quit”);
exit = 1;
}
if (SDL_PollEvent(&event) == 0)
{
switch (event.type)
{
case SDL_QUIT:
{
exit = 1;
}
}
}
}
}–
Per Beijer - @Per_Beijer