summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2008-05-28 22:40:14 +0000
committerSteve Northover <steve>2008-05-28 22:40:14 +0000
commit82b24e61015f6f60e3b1cfdefcd00574e1e53e1a (patch)
treef4c0c13ba16bb8855919fdb99304ddd702c82219
parente42c019f2a285ee0693f813be28788620d9b1560 (diff)
downloadeclipse.platform.swt-82b24e61015f6f60e3b1cfdefcd00574e1e53e1a.tar.gz
eclipse.platform.swt-82b24e61015f6f60e3b1cfdefcd00574e1e53e1a.tar.xz
eclipse.platform.swt-82b24e61015f6f60e3b1cfdefcd00574e1e53e1a.zip
234271 - Invalid thread access logged in the .log file
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java22
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java4
2 files changed, 23 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
index d70bd53ba3..b882b4fd91 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
@@ -680,7 +680,27 @@ protected void checkSubclass () {
protected void checkDevice () {
if (thread == null) error (SWT.ERROR_WIDGET_DISPOSED);
- if (thread != Thread.currentThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (thread != Thread.currentThread ()) {
+ /*
+ * Bug in IBM JVM 1.6. For some reason, under
+ * conditions that are yet to be full understood,
+ * Thread.currentThread() is either returning null
+ * or a different instance from the one that was
+ * saved when the Display was created. This is
+ * possibly a JIT problem because modifying this
+ * method to print logging information when the
+ * error happens seems to fix the problem. The
+ * fix is to use operating system calls to verify
+ * that the current thread is not the Display thread.
+ *
+ * NOTE: Despite the fact that Thread.currentThread()
+ * is used in other places, the failure has not been
+ * observed in all places where it is called.
+ */
+ if (threadId != OS.GetCurrentThreadId ()) {
+ error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+ }
if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
index 09250e4720..9fa412b94e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
@@ -347,8 +347,8 @@ protected void checkWidget () {
* that the current thread is not the Display thread.
*
* NOTE: Despite the fact that Thread.currentThread()
- * is used in other places, the failure has only been
- * observed here.
+ * is used in other places, the failure has not been
+ * observed in all places where it is called.
*/
if (display.threadId != OS.GetCurrentThreadId ()) {
error (SWT.ERROR_THREAD_INVALID_ACCESS);