I am working on a small Tile-Engine with SDL. Everything works quite fine exept of the termination of the application. I know that my program gets the SDL_QUIT event and tries to shut down the application, but it won’t. The main graphics-window closes down as it should, but the process is still running in the background and I have to quit it via Task-Manager.
Here the most important parts out of main:
//Initialize the SDL subsystems
if( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0 )
printf(“SDL initialized successfully\n”);
screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, PDEPTH, \
if ( screen == NULL )
printf(“Couldn’t initialize SDL: %s\n”, SDL_GetError());
printf(“SDL video-mode successfully initialized\n”);
// Set the timer to 30 ms
timerid = SDL_AddTimer(30, UpdateAndDraw, &data);
while(data.done == FALSE)
// quit the timer
screen = NULL;
// shutdown the game, free all the data like textures
I know that data.done gets set when I press Escape as it should, so the error should be somewhere below the loop. I also tried to run the program without initializing the timer and without the loop, but no success, still the same problem as before.
Hope you can help me, I don’t want to have a program which is not even able to quit correctly.
If it helps:
My OS: Windows
Compiler is DevC++ 18.104.22.168
SDL-Libs 1.2.4 are used—