summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-09 18:35:44 +0100
committerSven Gothel <[email protected]>2014-01-09 18:35:44 +0100
commit2b899a55e365aa03aeb234187600526777c1a9ac (patch)
treec48708400ae5866c43ba9267a5220fc1bee02fab /src
parent1a0b3287870beca22b0a03aa604fc6a5574a962b (diff)
NEWT DisplayImpl/PointerIcon: Don't use blocking isNativeValid() before and after EDT entry (deadlock)
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/jogamp/newt/DisplayImpl.java17
-rw-r--r--src/newt/classes/jogamp/newt/PointerIconImpl.java2
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());
}
} } );