summaryrefslogtreecommitdiffstats
path: root/src/demos/testContextDestruction/TestContextDestruction.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/testContextDestruction/TestContextDestruction.java')
-rwxr-xr-xsrc/demos/testContextDestruction/TestContextDestruction.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/demos/testContextDestruction/TestContextDestruction.java b/src/demos/testContextDestruction/TestContextDestruction.java
index f35a802..3adb73c 100755
--- a/src/demos/testContextDestruction/TestContextDestruction.java
+++ b/src/demos/testContextDestruction/TestContextDestruction.java
@@ -158,8 +158,15 @@ public class TestContextDestruction {
final Animator animator = new Animator(canvas);
WindowListener windowListener = 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();
}
};
frame1.addWindowListener(windowListener);