aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/sun/javafx
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-10 06:08:53 -0700
committerSven Gothel <[email protected]>2009-10-10 06:08:53 -0700
commit6f6436ab9c7345f4d3b7bf5d8ee70addc9f11ab0 (patch)
tree102a79454b60ee9d8cdb0f25490f1dbd548aa11c /src/newt/classes/com/sun/javafx
parent2268a6ce8a900ae7aa9f20d5f595f811185574a9 (diff)
NEWT: Avoid NPE at destroy() ; DEBUG println ..
Diffstat (limited to 'src/newt/classes/com/sun/javafx')
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Window.java12
-rw-r--r--src/newt/classes/com/sun/javafx/newt/util/EventDispatchThread.java12
2 files changed, 20 insertions, 4 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java
index 7bebe2125..b9d8bde42 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/Window.java
@@ -341,8 +341,8 @@ public abstract class Window implements NativeWindow
keyListeners = new ArrayList();
}
Screen scr = screen;
- Display dpy = screen.getDisplay();
- EventDispatchThread edt = dpy.getEDT();
+ Display dpy = (null!=screen) ? screen.getDisplay() : null;
+ EventDispatchThread edt = (null!=dpy) ? dpy.getEDT() : null;
if(null!=edt) {
final Window f_win = this;
edt.invokeAndWait(new Runnable() {
@@ -355,8 +355,12 @@ public abstract class Window implements NativeWindow
}
invalidate();
if(deep) {
- scr.destroy();
- dpy.destroy();
+ if(null!=scr) {
+ scr.destroy();
+ }
+ if(null!=dpy) {
+ dpy.destroy();
+ }
}
if(DEBUG_WINDOW_EVENT) {
System.out.println("Window.destroy() end "+Thread.currentThread());
diff --git a/src/newt/classes/com/sun/javafx/newt/util/EventDispatchThread.java b/src/newt/classes/com/sun/javafx/newt/util/EventDispatchThread.java
index f8b205a8b..e5a98cc55 100644
--- a/src/newt/classes/com/sun/javafx/newt/util/EventDispatchThread.java
+++ b/src/newt/classes/com/sun/javafx/newt/util/EventDispatchThread.java
@@ -37,9 +37,12 @@
package com.sun.javafx.newt.util;
import com.sun.javafx.newt.Display;
+import com.sun.javafx.newt.impl.Debug;
import java.util.*;
public class EventDispatchThread {
+ public static final boolean DEBUG = Debug.debug("EDT");
+
private ThreadGroup threadGroup;
private volatile boolean shouldStop = false;
private TaskWorker taskWorker = null;
@@ -92,6 +95,9 @@ public class EventDispatchThread {
shouldStop = true;
}
taskWorkerLock.notifyAll();
+ if(DEBUG) {
+ System.out.println(Thread.currentThread()+": EDT signal STOP");
+ }
}
}
@@ -168,6 +174,9 @@ public class EventDispatchThread {
}
public void run() {
+ if(DEBUG) {
+ System.out.println(Thread.currentThread()+": EDT run() START");
+ }
while(!shouldStop) {
try {
// wait for something todo ..
@@ -203,6 +212,9 @@ public class EventDispatchThread {
taskWorkerLock.notifyAll();
}
}
+ if(DEBUG) {
+ System.out.println(Thread.currentThread()+": EDT run() EXIT");
+ }
}
}
}