int __cdecl main(int argc, char* argv)
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER)<0) exit(-1);
// if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER)<0) exit(-1);
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?