The owner of a component calls this method to get rid of it.
Only the owner of this object calls the dispose method if
the object should be destroyed. All objects and components
must release the references to the objects. If the object is a
broadcaster, then all listeners are removed and the method
XEventListener::disposing
is called on all listeners.
Due to the importance of the concept of the method
XComponent::dispose , we provide a figurative
example:
Imagine there was a hole in the floor and some people
around it are holding a box (our component).
Everyone who holds the box for a longer time than just
temporaryly (i.e. to put something in or get something
out) has to watch a light bulb which is attached to
the box (listening to the XEventListener::disposing
event). Now, when the owner of the box switches the light on
(calling XComponent::dispose ),
everybody holding the box has to take his hands off
(clear the interface handles). If and only if everyone
does that, then the box falls (getting deleted).
But only the owner is allowed to switch the light on!
After this method is called the instance has to throw the
DisposedException for all calls not non-event-methods;
event-methods have to be ignored.