I think I may have identified another bug…
In my program, I had mistakenly forgotten to put PollEvents inside a while
loop. I was only calling it once, then going off to do video processing
before coming back for the next message. What I found was that after almost
exactly 10 seconds, my program would pull an SDL_QUIT event off of the
queue, with no apparent cause!
I eventually noticed that I was not polling every pending event and changed
my code - which cleared up my problem. But… why was that have been
happening at all??? I took a quick looked into the PollEvents->PeepEvents
code, but couldn’t definitely identify the cause. The problem didn’t
present itself in my Debug builds, so I suppose it could be that a piece of
allocated memory isn’t being cleared out before use and subsequent events
are stomping queued ones? (Sorry if that doesn’t make sense… it’s been a
I couldn’t re-create the problem in a small demo program, though it happened
consistently in my original program. I think that might be because of all
the extra code in the original program - it could be generating events not
found in my test demo (The original program is emulating the Intellivision).
Even though it seems I’ve ‘fixed’ the problem, I’m still concerned that the
problem could present itself randomly if a program were slowed down enough
to keep it from calling PollEvents until a few events had backed up.
In an even odder turn of events, adding a lot of tracing statements to my
code also seemed to eliminate the problem - like slowing down the program
actually prevents the problem instead of hastening it. Weird - like it has
to do with a specific timing between the event generation and polling.
Any SDL guru’s have an idea of what caused those spurious SDL_QUIT’s?
Thanks in advance,