Program won't close while event pump is active in 1.3

I’m building a game editor that hosts the engine in the editor. There’s a design mode and a run mode. In design mode, the map is frozen and can be edited, while in run mode, it turns on the SDL event pump and the animation. And I’ve discovered something interesting. In design mode, I have no trouble closing the program, but in run mode, it won’t close. Clicking the X in the title bar does nothing. Going to the system menu or the taskbar and saying Close does nothing. ALT-F4 registers as an SDL_KEYDOWN event but otherwise does nothing. An SDL_QUIT event never gets sent, and apparently the Delphi app never receives the notification either.

This only happens in run mode, when SDL_PumpEvents and SDL_PeekEvents are being called in a loop several times per second. Otherwise, it closes just fine. Anyone have any idea what’s going on and how I can fix it?

Mason Wheeler wrote:

This only happens in run mode, when SDL_PumpEvents and SDL_PeekEvents
are being called in a loop several times per second. Otherwise, it
closes just fine. Anyone have any idea what’s going on and how I can
fix it?

Could be that the event queue runs full (it’s 256 events max) when SDL tries to
push the event onto it. If that’s the case the only fix is to increase the size
of the queue. And that’s a compile-time constant.

It would be great if the SDL event queue could be sized when one initializes the
library or be resized at run-time. It’s quite possible that when one uses a lot
of user-defined events and use them for per-frame processing, the queue will run
full.

CE

I wrote some code for that a while ago, but I don’t know if I ever
posted it… I had it realloc() the event queue whenever it ran low
on space.On 04/07/2010, Chris Eineke wrote:

It would be great if the SDL event queue could be sized when one initializes
the library or be resized at run-time. It’s quite possible that when one uses a
lot of user-defined events and use them for per-frame processing, the queue will
run full.

Mason Wheeler wrote:

This only happens in run mode, when SDL_PumpEvents and SDL_PeekEvents
are being called in a loop several times per second. Otherwise, it
closes just fine. Anyone have any idea what’s going on and how I can
fix it?

Could be that the event queue runs full (it’s 256 events max) when SDL tries to
push the event onto it. If that’s the case the only fix is to increase the size
of the queue. And that’s a compile-time constant.

No, I’m not coming anywhere near overflowing the SDL event queue. Good
idea, though.>From: Chris Eineke

Subject: Re: [SDL] Program won’t close while event pump is active in 1.3