diff options
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 14 |
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() { |