From f24844c5e6c57a43df79224f2d3a89e9720726f7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 23 Nov 2012 09:09:17 +0100 Subject: Fix SWTEDTUtil Bug628: Perform NEWT event dispatching on SWT-EDT, due to possible triggered locking action, i.e. display(). Do the same for AWTEDTUtil. This fix actually clarifies the annotated FIXME :) --- make/scripts/tests.sh | 3 ++- src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java | 15 +++++++++------ src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java | 11 +++++------ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index fc9b47c69..a732d78fa 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -279,7 +279,7 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer01GLCanvasAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $* -testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* +#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $* @@ -372,6 +372,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn $* #testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $* #testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTGLn $* +testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTBug628ResizeDeadlock $* # # newt.awt (testawt) diff --git a/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java index d4b83d891..d40aa18cf 100644 --- a/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java +++ b/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java @@ -231,12 +231,15 @@ public class SWTEDTUtil implements EDTUtil { do { // event dispatch if(!shouldStop) { - // FIXME: Determine whether we require to run the - // delivery of events (dispatch) on AWT-EDT. - // Since the WindowDriver itself delivers all Window related events, - // this shall not be required. - // AWTEDTExecutor.singleton.invoke(true, dispatchMessages); - dispatchMessages.run(); + // EDT invoke thread is SWT-EDT, + // hence dispatching is required to run on SWT-EDT as well. + // Otherwise a deadlock may happen due to dispatched event's + // triggering a locking action. + if ( !swtDisplay.isDisposed() ) { + swtDisplay.syncExec(dispatchMessages); + } else { + dispatchMessages.run(); + } } // wait synchronized(sync) { diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java index 8771f5c74..6fa053dd3 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java @@ -215,12 +215,11 @@ public class AWTEDTUtil implements EDTUtil { do { // event dispatch if(!shouldStop) { - // FIXME: Determine whether we require to run the - // delivery of events (dispatch) on AWT-EDT. - // Since the WindowDriver itself delivers all Window related events, - // this shall not be required. - // AWTEDTExecutor.singleton.invoke(true, dispatchMessages); - dispatchMessages.run(); + // EDT invoke thread is AWT-EDT, + // hence dispatching is required to run on AWT-EDT as well. + // Otherwise a deadlock may happen due to dispatched event's + // triggering a locking action. + AWTEDTExecutor.singleton.invoke(true, dispatchMessages); } // wait synchronized(sync) { -- cgit v1.2.3