diff options
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java index d40aa18cf..d08fefa29 100644 --- a/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java +++ b/src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java @@ -154,17 +154,23 @@ public class SWTEDTUtil implements EDTUtil { // Thread.dumpStack(); } } - - // start if should not stop && not started yet - if( !stop && !nedt.isRunning() ) { - startImpl(); + if( isCurrentThreadEDT() ) { + task.run(); + wait = false; // running in same thread (EDT) -> no wait + } else if( swtDisplay.isDisposed() ) { + wait = false; // drop task, SWT disposed + } else { + // start if should not stop && not started yet + if( !stop && !nedt.isRunning() ) { + startImpl(); + } + if(wait) { + swtDisplay.syncExec(task); + } else { + swtDisplay.asyncExec(task); + } } } - if(wait) { - swtDisplay.syncExec(task); - } else { - swtDisplay.asyncExec(task); - } } @Override |