Running Apps in Sequence in Same SDL "Session"

int __cdecl main(int argc, char* argv[])
{
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER)<0) exit(-1);
App();
// SDL_Quit();

// if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER)<0) exit(-1);
App();
SDL_Quit();

return(0);
}

Consider the simple code above. I initialize SDL subsystems, and I call App, which displays an SDL window with OpenGL content. When I close that window, App returns and then executes again. A window appears, and, when I close it, the second instance of App returns, SDL_Quit is called, and then main returns.

There is an unexpected behavior. When I close the window associated with the first instance of App, the window does not disappear, although clearly its event loop quits. Then, when the second instance of App executes, closing either window causes both windows to disappear. (Only the second window responds to other classes of events.) If I uncomment the two commented lines, the program has the expected behavior.

Why doesn’t the first window disappear when I close it?

I neglected to mention that the behavior I noted was with SDL 1.3 and my APL2 “scripting” environment. I have reproduced the application in C, and, there, SDL 1.3 has no difficulty with the back-to-back sessions as described above.

I apologize if I caused anyone to waste time attempting to experiment with this “false alarm.”