2006-10-12

SWT Widget.dispose() Doesn't Get Called

The API documentation for org.eclipse.swt.widgets.Widget#dispose() has this interesting tidbit:

NOTE: This method is not called recursively on the descendents of the receiver. This means that, widget implementers can not detect when a widget is being disposed of by re-implementing this method, but should instead listen for the Dispose event.

Thus, the only reliable way for a widget to know if it has been disposed is to add a DisposeListener to itself.