[vtkusers] What exactly happens in this scenario?

logic_cube John.Fraser at icr.ac.uk
Fri Jun 25 08:51:19 EDT 2010


Shouldn't it be like this?

if (elementNumberActor != NULL)
{
elementNumberActor->Delete();
elementNumberActor = NULL;
}



Bill Lorensen-2 wrote:
> 
> Yes, it will leak.
> 
> To prevent the leak,, in your constructor,
> elementNumberActor = NULL;
> 
> In DisplayElementNumbers() before assigning the actor,
> if (elementNumberActor != NULL)
> {
> elementNumberActor->Delete();
> }
> 
> In the destuctor,
> if (elementNumberActor != NULL)
> {
> elementNumberActor->Delete();
> }
> 
> 

-- 
View this message in context: http://old.nabble.com/What-exactly-happens-in-this-scenario--tp28991361p28991987.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list