<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BLOCKQUOTE type="cite">vtkRendererCollection* rendererCollection = renderWin->GetRenderers(); </BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>You are getting a POINTER to an object that you DO NOT own. You do not have to call redererCollectio::Delete(). <DIV><BR class="khtml-block-placeholder"></DIV><DIV>If you use the following:</DIV><DIV><BR class="khtml-block-placeholder"></DIV>vtkRendererCollection* rendererCollection = vtkRendererCollection::New();<DIV><BR class="khtml-block-placeholder"></DIV><DIV>then you have to call ::Delete() on the object. In other words, if you did _Create_ the object then you do NOT need to free the memory.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>If you DID create the object then you are responsible for freeing the memory.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><DIV>Lastly, if you use the vtkSmartPointer class then you will not need to worry about any of the above when creating objects as vtk will "do the right thing" because the objects are reference counted.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>vtkSmartPointer<vtkPoints> nodes = vtkSmartPointer<vtkPoints>::New();</DIV><DIV>when the context that this was created is exited (method or block) then the smartpointer destructor is called and the object will be deleted if the ref count is 0. If you passed the object as an argument to another method, and the method needs to keep the object around longer, then that method will increment the ref count ( vtkObject.register() ).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>HTH<BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Bitstream Vera Sans; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-- </DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Mike Jackson Senior Research Engineer</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Innovative Management & Technology Services</DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR><DIV><DIV>On Aug 4, 2007, at 4:05 PM, rashed karim wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">Hi VTK users, <BR><BR>Inside a function I do this: <BR>vtkRendererCollection* rendererCollection = renderWin->GetRenderers(); <BR><BR>Where I am basically getting the renderers associated with a rendering window. Further down in the code I extract the renderer from the collection and delete any existing actors in the renderer and replace it with a new actor. <BR><BR>When exiting the function, I start freeing up the memory by invoking on Delete( ) on the renderer, actor, etc. But here is where it gets all wierd - when I delete the rendererCollection object, I can no longer interact with my actor. Does anyone know why? <BR><BR>Thanks<BR>Rashed Karim. <BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">This is the private VTK discussion list.<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Please keep messages on-topic. Check the FAQ at: <A href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Follow this link to subscribe/unsubscribe:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></DIV></BODY></HTML>