diff options
author | Steve Northover <steve> | 2008-05-28 22:40:14 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2008-05-28 22:40:14 +0000 |
commit | 82b24e61015f6f60e3b1cfdefcd00574e1e53e1a (patch) | |
tree | f4c0c13ba16bb8855919fdb99304ddd702c82219 | |
parent | e42c019f2a285ee0693f813be28788620d9b1560 (diff) | |
download | eclipse.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-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java | 22 | ||||
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java | 4 |
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); |