SDL_PollEvent() hangs too many SDL_JOYMOTIONEVENTs

Hello,

Im working on Hedgewars, and I am porting it to Android. I’ve used the
official SDL1.3 port to Android. Worth noting is that using the
unoffical SDL1.2 port from Pelya i do not have the problem below.

I’ve got the following while-loop in the MainLoop of the program:

   while SDL_PollEvent(@event) <> 0 do
   begin
       case event.type_ of
           SDL_KEYDOWN: if GameState = gsChat then

{$IFDEF SDL13}
// sdl on iphone supports only ashii keyboards and
the unicode field is deprecated in sdl 1.3
KeyPressChat(event.key.keysym.sym);
SDL_WINDOWEVENT:
if event.window.event = SDL_WINDOWEVENT_SHOWN then
cHasFocus:= true;
{$ELSE}
KeyPressChat(event.key.keysym.unicode);
SDL_MOUSEBUTTONDOWN: if event.button.button =
SDL_BUTTON_WHEELDOWN then wheelDown:= true;
SDL_MOUSEBUTTONUP: if event.button.button =
SDL_BUTTON_WHEELUP then wheelUp:= true;
SDL_ACTIVEEVENT:
if (event.active.state and SDL_APPINPUTFOCUS) <> 0
then
cHasFocus:= event.active.gain = 1;
{$ENDIF}
SDL_JOYAXISMOTION:
ControllerAxisEvent(event.jaxis.which, event.jaxis.axis,
event.jaxis.value);
SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which,
event.jhat.hat, event.jhat.value);
SDL_JOYBUTTONDOWN:
ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true);
SDL_JOYBUTTONUP:
ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false);
SDL_QUITEV: isTerminated:= true
end; //end case event.type_ of
end; //end while SDL_PollEvent(@event) <> 0 do

It’s written in FreePascal, I cannot get out of this loop, because
SDL_PollEvent keeps giving me new SDL_JOYAXISMOTION events. For our
IPhone port we’ve used a different struct for SDL_MOUSEMOTIONEVENT, but
both that one and the proper SDL1.3 struct keep the program hanging.

Does anyone have an idea how to go about debugging this?

Thanks in advance,

Xeli