# HG changeset patch # User Bob Pendleton # Date 1203550053 0 # Node ID 0c653886cce7c877713aeae5ad8497a0e82b34d3 # Parent f537a293b3dab5f0ce93ae440571bd3f00f03cd2 HandleEvent() returns done each time it is called. If done was set to 0 the program should quit, but because done is not checked until *all* events are handled a following event can reset done to 1 and prevent the program from terminating when told to. I fixed the while loop that handles events to check for the state of done after handling each event. That could leave some events unhandled when the program exits, but it ensures that the program will exit. diff -r f537a293b3da -r 0c653886cce7 test/testgl.c --- a/test/testgl.c Mon Feb 11 21:06:32 2008 +0000 +++ b/test/testgl.c Wed Feb 20 23:27:33 2008 +0000 @@ -666,7 +666,7 @@ } /* Check if there's a pending event. */ - while (SDL_PollEvent(&event)) { + while (!done && SDL_PollEvent(&event)) { done = HandleEvent(&event); } ++frames;