When I'm closing the main window I'm getting an error because it's disposed. I'm trying to "filter out" (using a condition), but I can't get it to work.
if(!Display.getDefault().isDisposed()){
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
View.tableViewer.refresh();
setViewInfo();
}
});
}
Error:
Exception in thread "Thread-3" org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.swt.SWTException: Widget is disposed) at org.eclipse.swt.SWT.error(SWT.java:4361) at org.eclipse.swt.SWT.error(SWT.java:4276) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:196) at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150) at org.eclipse.swt.widgets.Display.syncExec(Display.java:4687) at com.chriss.udp.Message.WRITE(Message.java:166) at com.chriss.udp.threads.ThreadConnect.run(ThreadConnect.java:55) at java.lang.Thread.run(Unknown Source) Caused by: org.eclipse.swt.SWTException: Widget is disposed
You can ask whether Widget is disposed.
boolean isDisposed()
Returns true if the widget has been disposed, and false otherwise.
You have not to check the display, because as long as the application is running it is not disposed. You have to check the table or this.isDisposed() inside the runnable.
Please post the full stack trace. I thinl the problem is inside the runnable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With