Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Exception when disposing GC
Exception when disposing GC [message #443055] Fri, 17 September 2004 22:17
Fernando is currently offline FernandoFriend
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... :-)
Previous Topic:Exception when disposing GC
Next Topic:Text widget flickers on XP with SWT.WRAP
Goto Forum:
  


Current Time: Tue Sep 24 03:12:32 GMT 2024

Powered by FUDForum. Page generated in 0.03159 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top