diff options
author | Sven Gothel <[email protected]> | 2023-10-01 19:55:12 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-10-01 19:55:12 +0200 |
commit | b0893eda1035bcb1c6a88e52dac6cd00dfedf696 (patch) | |
tree | 689682e740baee4c032d21ecf4cfd459af1777a1 /src/demos/com | |
parent | 05a344b98277a19858cd5c4a22e93620ec05a8d5 (diff) |
Bug 1468: Demos MiscUtil.destroyWindow() Call GLAutoDrawable.destroy() directly w/o mitigation attempts (off-thread)
Diffstat (limited to 'src/demos/com')
-rw-r--r-- | src/demos/com/jogamp/opengl/demos/av/MovieCube.java | 8 | ||||
-rw-r--r-- | src/demos/com/jogamp/opengl/demos/av/MovieSimple.java | 16 | ||||
-rw-r--r-- | src/demos/com/jogamp/opengl/demos/util/MiscUtils.java | 6 |
3 files changed, 23 insertions, 7 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieCube.java b/src/demos/com/jogamp/opengl/demos/av/MovieCube.java index ace46883a..d94a3a05b 100644 --- a/src/demos/com/jogamp/opengl/demos/av/MovieCube.java +++ b/src/demos/com/jogamp/opengl/demos/av/MovieCube.java @@ -316,7 +316,6 @@ public class MovieCube implements GLEventListener { case KeyEvent.VK_LEFT: pts1 = pts0 - 1000; break; case KeyEvent.VK_DOWN: pts1 = pts0 - 10000; break; case KeyEvent.VK_PAGE_DOWN: pts1 = pts0 - 30000; break; - case KeyEvent.VK_ESCAPE: case KeyEvent.VK_HOME: case KeyEvent.VK_BACK_SPACE: { mPlayer.seek(0); @@ -369,6 +368,13 @@ public class MovieCube implements GLEventListener { printScreenOnGLThread(autoDrawable); } break; + case KeyEvent.VK_F4: + case KeyEvent.VK_ESCAPE: + case KeyEvent.VK_Q: + if(null != autoDrawable) { + MiscUtils.destroyWindow(autoDrawable); + } + break; } if( 0 != pts1 ) { diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java index 13c329504..504d97990 100644 --- a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java +++ b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java @@ -216,6 +216,14 @@ public class MovieSimple implements GLEventListener { } private final MouseListener mouseAction = new MouseAdapter() { + + @Override + public void mouseClicked(final MouseEvent e) { + if(null != autoDrawable && e.getClickCount() == 3 ) { + MiscUtils.destroyWindow(autoDrawable); + } + } + @Override public void mousePressed(final MouseEvent e) { if(e.getY()<=surfHeight/2 && null!=mPlayer && 1 == e.getClickCount()) { @@ -301,7 +309,6 @@ public class MovieSimple implements GLEventListener { case KeyEvent.VK_LEFT: pts1 = pts0 - 1000; break; case KeyEvent.VK_DOWN: pts1 = pts0 - 10000; break; case KeyEvent.VK_PAGE_DOWN: pts1 = pts0 - 30000; break; - case KeyEvent.VK_ESCAPE: case KeyEvent.VK_HOME: case KeyEvent.VK_BACK_SPACE: { mPlayer.seek(0); @@ -354,6 +361,13 @@ public class MovieSimple implements GLEventListener { printScreenOnGLThread(autoDrawable); } break; + case KeyEvent.VK_F4: + case KeyEvent.VK_ESCAPE: + case KeyEvent.VK_Q: + if(null != autoDrawable) { + MiscUtils.destroyWindow(autoDrawable); + } + break; } if( 0 != pts1 ) { diff --git a/src/demos/com/jogamp/opengl/demos/util/MiscUtils.java b/src/demos/com/jogamp/opengl/demos/util/MiscUtils.java index 9284dfc84..b2f1a56b6 100644 --- a/src/demos/com/jogamp/opengl/demos/util/MiscUtils.java +++ b/src/demos/com/jogamp/opengl/demos/util/MiscUtils.java @@ -257,13 +257,9 @@ public class MiscUtils { public static void destroyWindow(final GLAutoDrawable glad) { if( glad.isRealized() ) { glad.setExclusiveContextThread(null); - final GLAnimatorControl actrl = glad.getAnimator(); - if( null != actrl ) { - actrl.stop(); - } System.err.println("Destroying window from thread "+Thread.currentThread()); // Thread.dumpStack(); - new InterruptSource.Thread( () -> { glad.destroy(); } ).start(); + glad.destroy(); } } } |