diff options
author | Sven Gothel <[email protected]> | 2014-01-09 18:35:44 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-01-09 18:35:44 +0100 |
commit | 2b899a55e365aa03aeb234187600526777c1a9ac (patch) | |
tree | c48708400ae5866c43ba9267a5220fc1bee02fab | |
parent | 1a0b3287870beca22b0a03aa604fc6a5574a962b (diff) |
NEWT DisplayImpl/PointerIcon: Don't use blocking isNativeValid() before and after EDT entry (deadlock)
-rw-r--r-- | src/newt/classes/jogamp/newt/DisplayImpl.java | 17 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/PointerIconImpl.java | 2 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index 4c7169ec4..b485a4763 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -110,9 +110,6 @@ public abstract class DisplayImpl extends Display { public final PointerIcon createPointerIcon(final IOUtil.ClassResources pngResource, final int hotX, final int hotY) throws IllegalArgumentException, IllegalStateException, IOException { - if( !isNativeValid() ) { - throw new IllegalStateException("Display.createPointerIcon(1): Display invalid "+this); - } if( null == pngResource || 0 >= pngResource.resourceCount() ) { throw new IllegalArgumentException("Null or invalid pngResource "+pngResource); } @@ -123,8 +120,8 @@ public abstract class DisplayImpl extends Display { runOnEDTIfAvail(true, new Runnable() { public void run() { try { - if( !DisplayImpl.this.isNativeValid() ) { - throw new IllegalStateException("Display.createPointerIcon(2): Display invalid "+DisplayImpl.this); + if( !DisplayImpl.this.isNativeValidAsync() ) { + throw new IllegalStateException("Display.createPointerIcon: Display invalid "+DisplayImpl.this); } final URLConnection urlConn = pngResource.resolve(0); if( null == urlConn ) { @@ -162,9 +159,6 @@ public abstract class DisplayImpl extends Display { public final PointerIcon createPointerIcon(final PixelRectangle pixelrect, final int hotX, final int hotY) throws IllegalArgumentException, IllegalStateException { - if( !isNativeValid() ) { - throw new IllegalStateException("Display.createPointerIcon(1): Display invalid "+this); - } if( null == pixelrect ) { throw new IllegalArgumentException("Null or pixelrect"); } @@ -194,8 +188,8 @@ public abstract class DisplayImpl extends Display { runOnEDTIfAvail(true, new Runnable() { public void run() { try { - if( !DisplayImpl.this.isNativeValid() ) { - throw new IllegalStateException("Display.createPointerIcon(2): Display invalid "+DisplayImpl.this); + if( !DisplayImpl.this.isNativeValidAsync() ) { + throw new IllegalStateException("Display.createPointerIcon: Display invalid "+DisplayImpl.this); } if( null != fpixelrect ) { final long handle = createPointerIconImplChecked(fpixelrect.getPixelformat(), @@ -630,6 +624,9 @@ public abstract class DisplayImpl extends Display { public synchronized final boolean isNativeValid() { return null != aDevice; } + protected final boolean isNativeValidAsync() { + return null != aDevice; + } @Override public boolean isEDTRunning() { diff --git a/src/newt/classes/jogamp/newt/PointerIconImpl.java b/src/newt/classes/jogamp/newt/PointerIconImpl.java index 7c8535f20..840799d55 100644 --- a/src/newt/classes/jogamp/newt/PointerIconImpl.java +++ b/src/newt/classes/jogamp/newt/PointerIconImpl.java @@ -130,7 +130,7 @@ public class PointerIconImpl implements PointerIcon { } display.runOnEDTIfAvail(false, new Runnable() { public void run() { - if( display.isNativeValid() ) { + if( !display.isNativeValidAsync() ) { destroyOnEDT(display.getHandle()); } } } ); |