我有一个TableViewer
的监听器类,并调用remove(Object)
来删除表中的行。代码正在使用Display.getDefault().syncExec
,但似乎仍存在一些同步问题。此事也不会一直发生,并且由于某种原因只发生在Windows 7而不是Windows XP中。我们尝试在删除对象之前检查TableViewer.getTable().isDisposed()
,但我们仍然得到" Widget已被处置"错误。
有没有人有任何想法如何防止这种情况?我们正在使用jface-3.2.0。非常感谢任何帮助。
org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.swt.SWTException: Widget is disposed)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Unknown Source)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:822)
at org.eclipse.jface.window.Window.open(Window.java:798)
at com.sdm.hw.client.swt.HwMain.main(HwMain.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Widget.error(Unknown Source)
at org.eclipse.swt.widgets.Widget.checkWidget(Unknown Source)
at org.eclipse.swt.widgets.Widget.getData(Unknown Source)
at org.eclipse.jface.viewers.TableViewer.doFindItem(TableViewer.java:404)
at org.eclipse.jface.viewers.StructuredViewer.findItems(StructuredViewer.java:776)
at org.eclipse.jface.viewers.StructuredViewer.findItem(StructuredViewer.java:731)
at org.eclipse.jface.viewers.TableViewer.setSelectionToWidget(TableViewer.java:1138)
at org.eclipse.jface.viewers.StructuredViewer.setSelectionToWidget(StructuredViewer.java:1619)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1330)
at org.eclipse.jface.viewers.TableViewer.remove(TableViewer.java:993)