[vtkusers] question on memory + vtkactorcollection in c++
Koning, P.J.H. de (LKEB)
P.J.H.de_Koning at lumc.nl
Thu Sep 19 10:28:59 EDT 2002
19-09-02 15:19:24, "Gopalakrishnan, Gowri" <Gowri.Gopalakrishnan at inteq.com> wrote:
The actor is still being referenced by the actor collection. If you call col->Delete() both the actor and the collection will be deleted, assuming you haven't attached the
actor to a renderer.
vtkActor *myactor = vtkActor::New()
vtkActorCollection *col = vtkactorCollection::New()
col -> AddItem(myactor);
myactor -> Delete(); // this does not delete the actor, it just decreases the ref coun tfrom 2 to 1
col->Delete(); // Deletes both the actor and the actor collection
>
>
> From: "Gopalakrishnan, Gowri" <Gowri.Gopalakrishnan at inteq.com>
>
> To: "'vtkusers at public.kitware.com'" <vtkusers at public.kitware.com>
> Subject:[vtkusers] question on memory + vtkactorcollection in c++
> Date: Thu, 19 Sep 2002 08:19:24 -0500
>
>
>
> Hi In the following scenario
>
>
>
>
> vtkActor *myactor = vtkActor::New()
> vtkActorCollection *col = vtkactorCollection::New()
>
> col -> AddItem(myactor);
>
>
> myactor -> Delete() // this deletes the myactor (may be)
>
>
> I can do,
>
>
> Col -> GetItem()->GetProperty->SetColor() to change the color of the
>
> original actor......This works....
>
>
> Does that mean myactor -> Delete() did not actually delete the actor since
>
> its reference count is not zero....
> So when will this actor be deleted?. When the reference goes to zero is it
>
> automatically deleted?.
>
>
>
>
> In addition before quitting the program if I do col->getActor()->Delete()
> ....this crashes ( possibly correct behaviour since this was not created
>
> with a new....)
>
>
> Can some one shed some light on this please.......
>
>
> Thanks a lot
>
>
> Regards
>
> Gowri
>
>
>
>
>
>
More information about the vtkusers
mailing list