summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-06-27 02:49:18 +0200
committerSven Gothel <[email protected]>2012-06-27 02:49:18 +0200
commit4a0a5d69ffcb7592b092991ddb3761653c389ce6 (patch)
tree44ec0b303247523004ce5abd52b86975185a37a0
parent70d9ac4ac866a21a2dbcc3f779ef2b3f81a7e29d (diff)
NEWT WindowImpl.runOnEDTIfAvail(..): Run task from current thread if owning the windowLock. Avoiding deadlock when cmds issued from within locked code path.
This allows e.g. GLEventListener::display(..) { .. glWindow.setSize(100, 100); .. }
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 68a2430f7..73bd9ed1c 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1574,12 +1574,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
public void runOnEDTIfAvail(boolean wait, final Runnable task) {
- Screen scrn = getScreen();
- if(null==scrn) {
- throw new RuntimeException("Null screen of inner class: "+this);
+ if(windowLock.isOwner()) {
+ task.run();
+ } else {
+ Screen scrn = getScreen();
+ if(null==scrn) {
+ throw new RuntimeException("Null screen of inner class: "+this);
+ }
+ DisplayImpl d = (DisplayImpl) scrn.getDisplay();
+ d.runOnEDTIfAvail(wait, task);
}
- DisplayImpl d = (DisplayImpl) scrn.getDisplay();
- d.runOnEDTIfAvail(wait, task);
}
private final Runnable requestFocusAction = new Runnable() {