summaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes')
-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");
+ }
}
}
}