[vtkusers] What exactly happens in this scenario?

Bill Lorensen bill.lorensen at gmail.com
Fri Jun 25 08:53:33 EDT 2010


In the destructor? Technically, yes. But it won't matter.

On Fri, Jun 25, 2010 at 8:51 AM, logic_cube <John.Fraser at icr.ac.uk> wrote:
>
> 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.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list