Keyboard input and Seg Faults

Hello all,

I’ve written a simple menu system. which takes keyboard i/p (SDLK_UP and
SDLK_DOWN) like this

do{ SDL_WaitEvent(&event); }
while(event.type != SDL_KEYDOWN);//wait for user i/p
switch(event.key.keysym.sym)
{

//LOOK AFTER Input

}

It works, kind of. When you terror test this (by pressing up and down lots of
times and holding down for several seconds etc) after a few seconds i get the
dreaded…

Fatal signal: Segmentation Fault (SDL Parachute Deployed)

Anyone have any ideas why this is happening?

Cheers,

Lee

Lee Tobin wrote:

Hello all,

I’ve written a simple menu system. which takes keyboard i/p (SDLK_UP and
SDLK_DOWN) like this

do{ SDL_WaitEvent(&event); }
while(event.type != SDL_KEYDOWN);//wait for user i/p
switch(event.key.keysym.sym)
{

//LOOK AFTER Input

}

It works, kind of. When you terror test this (by pressing up and down lots of
times and holding down for several seconds etc) after a few seconds i get the
dreaded…

Fatal signal: Segmentation Fault (SDL Parachute Deployed)

Anyone have any ideas why this is happening?

That means your program crashed, and that you probably have a bug in it.
But we can’t be sure without a full source code reproducing the problem.
Could you make an example reproducing the problem available ?

Stephane

That means your program crashed, and that you probably have a bug in it.
But we can’t be sure without a full source code reproducing the problem.
Could you make an example reproducing the problem available ?

Stephane

Stephane,

Thanks for your reply. I fixed it! In an effort to reproduce the error i
started to “cut down” my current code so i could post it here. I noticed a
rogue TTF_OpenFont() call. So every time the menu system repainted there were
about 50 calls to TTF_OpenFont(). Removed it and now no Seg faults.

Cheers,

Lee