The javadoc of SWT CTabItem.dispose() mentioned that:
This method is not called recursively on the descendants of the receiver
What is the reason behind that? If the CTabItem is disposed, the child widgets are not displayed anymore. Why they are not disposed recursively?
Would there be any problem if I override the CTabItem.dispose() method to dispose the child widgets recursively?
Thanks
That comment is actually in the JavaDoc for the
Widgetclass whichCTabItemis derived from, it applies to all controls.When you call
disposethe children of the control are destroyed, but not by calling the child controlsdisposemethod.The JavaDoc is telling you that overriding the
disposemethod won't work if you want to know when the control is disposed, instead you must listen for theSWT.Disposedevent.The code for
Widget.disposeis:and
release:So it is the
releasemethod that callsreleaseChildrento destroy the children.releaseChildrenfor theCompositecontrol is:So this calls
releaseon the child control (notdispose)