[vtkusers] Dispose to vtk objects
David Cole
dlrdave at aol.com
Mon Jun 24 11:42:21 EDT 2013
> Hi VTKers,
> Could someone please clarify this,
> I think it is relevant to any activiz application...
> I wrote a huge dispose function for disposing all the pipeline
> Is it really necessary? For this I need to track all the actors and all the
> filters for them to get disposed...
As I said in my previous replies to this thread, you should only call “Dispose” explicitly if it turns out to be necessary for a particular construction of a connected objects network.
In general, you should NOT need to call Dispose.
You CAN call it if necessary, but ONLY if you’re sure no other references to the object exist on the managed side. (Because if they do, and you Dispose of the object, that other reference may try to call a method on it later that will not succeed because Dispose has already been called...)
I would say it is safe to call it at Form_Closed time or app shutdown, or some other similar situation in which many objects are being Disposed, deleted and forgotten about, and there will be no more calls via any references to them.
Calls to Dispose are unnecessary unless proven otherwise.
If you have a particular code snippet to send along, where you think Dispose really is necessary, then talking about a particular example is easier than this sort of general discussion.
David C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130624/3201356d/attachment.htm>
More information about the vtkusers
mailing list