I created a “complex” composite, which contains some widgets and listens for some events (i.e., it register itself into another element). I also implemented a dispose method in that composite, which deregister itself from the notifications and call the dispose on the composite (super.dispose()).
I use this widget in several places, including a page of a Wizard. However, it seems that when the wizard closes (either with a “finish” or a “cancel”), my widget is not disposed. Indeed, the dispose method of a WizardPage is pretty simple, as it only cleans the image.
Am I missing something or I must perform an explicit dispose on my composite?
You can call your
dispose()implementation of your “complex” composite class for cleaning up resources allocated this widget explicitly within your implementation of the wizard pagedispose()method, but this only works for the wizard page!.A better way seems to add a dispose listener to your composite/widget and perform cleanup steps in the
widgetDisposed(DisposeEvent e)method of the DisposeListener.