diff options
Diffstat (limited to 'src/demos/cg/runtime_ogl/cgGL_vertex_example.java')
-rw-r--r-- | src/demos/cg/runtime_ogl/cgGL_vertex_example.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java index 16c3e1a..ec2cb9a 100644 --- a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java +++ b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java @@ -267,8 +267,15 @@ public class cgGL_vertex_example implements GLEventListener final Animator animator = new Animator(canvas); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { - animator.stop(); - System.exit(0); + // Run this on another thread than the AWT event queue to + // make sure the call to Animator.stop() completes before + // exiting + new Thread(new Runnable() { + public void run() { + animator.stop(); + System.exit(0); + } + }).start(); } }); frame.show(); |