aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/com/jogamp/newt/swt/SWTEDTUtil.java24
-rw-r--r--src/newt/classes/jogamp/newt/DefaultEDTUtil.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java14
3 files changed, 25 insertions, 15 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
diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
index 18418a8dc..98987ef96 100644
--- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
@@ -150,7 +150,7 @@ public class DefaultEDTUtil implements EDTUtil {
System.err.println("Warning: EDT about (1) to stop, won't enqueue new task: "+edt);
Thread.dumpStack();
}
- return;
+ return;
}
// System.err.println(Thread.currentThread()+" XXX stop: "+stop+", tasks: "+edt.tasks.size()+", task: "+task);
// Thread.dumpStack();
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
index 6fa053dd3..01b5ad8a4 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
@@ -142,13 +142,17 @@ public class AWTEDTUtil 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 {
+ // start if should not stop && not started yet
+ if( !stop && !nedt.isRunning() ) {
+ startImpl();
+ }
+ AWTEDTExecutor.singleton.invoke(wait, task);
}
}
- AWTEDTExecutor.singleton.invoke(wait, task);
}
@Override