Exception when disposing GC [message #443055] |
Fri, 17 September 2004 22:17 |
Fernando Messages: 7 Registered: July 2009 |
Junior Member |
|
|
Hi,
I have a widget that extends from Composite and that registers a listener
to DisposeEvent like this:
addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if( !gc.isDisposed() ){
gc.dispose();
}
}
});
gc is a class field and is created at its initialization.
When the screen that contains the widget is disposed and the event is
raized (i.e. widgetDisposed is called) I got the following exception:
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.Widget.error(Unknown Source)
at org.eclipse.swt.widgets.Widget.checkWidget(Unknown Source)
at org.eclipse.swt.widgets.Control.internal_dispose_GC(Unknown
Source)
at org.eclipse.swt.graphics.GC.dispose(Unknown Source)
at com.X.BaseWidget.widgetDisposed(BaseWidget.java:274)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown
Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.releaseWidget(Unknown Source)
at org.eclipse.swt.widgets.Control.releaseWidget(Unknown Source)
at org.eclipse.swt.widgets.Scrollable.releaseWidget(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseWidget(Unknown Source)
at org.eclipse.swt.widgets.Widget.releaseResources(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown
Source)
at org.eclipse.swt.widgets.Composite.releaseWidget(Unknown Source)
at org.eclipse.swt.widgets.Widget.releaseResources(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown
Source)
at org.eclipse.swt.widgets.Composite.releaseWidget(Unknown Source)
at org.eclipse.swt.widgets.Widget.dispose(Unknown Source)
Couldn't I dispose gc inside widgetDisposed()?
Do you see any problem in maintaining just one reference to GC instead of
creating and disposing it on demand (for performance reasons)?
Thanks,
Fernando.
P.S.: Sorry about the other related/incomplete thread. TAB problens... :-)
|
|
|
Powered by
FUDForum. Page generated in 0.03159 seconds