summaryrefslogtreecommitdiffstats
path: root/src/demos/cg/runtime_ogl_vertex_fragment
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-02-14 22:19:43 +0000
committerKenneth Russel <[email protected]>2005-02-14 22:19:43 +0000
commit69ca977ccf8d329cd72dced5ebb92501da460561 (patch)
tree22c527a2caa861385506f2b66638ce3ff4c991bc /src/demos/cg/runtime_ogl_vertex_fragment
parent9813d9cb28d5cca8ade58cd2bec82f364189f534 (diff)
Fixed problem in demos introduced in 1.1 b08 where windowClosing
events were not properly waiting for the Animator to stop. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@55 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/cg/runtime_ogl_vertex_fragment')
-rw-r--r--src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
index 38ab297..3ceabc0 100644
--- a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
+++ b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
@@ -74,12 +74,18 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
frame.setSize(512, 512);
final Animator animator = new Animator(canvas);
frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- animator.stop();
- System.out.println("Exiting");
- System.exit(0);
- }
- });
+ public void windowClosing(WindowEvent e) {
+ // 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();
animator.start();