Space Invaders 102 - OpenGL

[quote][…]
This is cause by the abrupt way the tutorial exits the game. It calls System.exit(0) at a time when we could be rendering. To prevent it, instead of calling System.exit(0) set a flag and use it to call exit() inside the rendering loop. The problem is that the rendering thread continues even through the window has been destroyed at exit.[…]
[/quote]


boolean running=true;
[...]
while(running)//main loop
{
stuff
}

Or while(!finished), but I like the “positive” version a bit more.