[Paraview] vtkDataObjectAlgorithm with multiple inputs

David E DeMarle dave.demarle at kitware.com
Tue Aug 25 13:39:52 EDT 2009


Since that call to Delete doesn't actually destroy anything (It just
decrements the object's reference count from 2 to 1) both are equivalent and
it is just a matter of preference. If you put it right there it is less
likely to be forgotten later. This happens for example when someone adds a
conditional return somewhere before the intended Delete.

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109


On Tue, Aug 25, 2009 at 1:33 PM, Paul Edwards <paul.m.edwards at gmail.com>wrote:

> Hi,
>
> I understand there is a need to call Delete on the object but I don't
> understand why it is called before the line that uses the object that has
> just been deleted.  I.e. why isn't it:
>
> this->GetOutputPortInformation(0)->Set(
>
> vtkDataObject::DATA_EXTENT_TYPE(), *newOutput->GetExtentType()*);
>
> *newOutput->Delete();*
> *
> *
>
> instead of:
>
>
> *newOutput->Delete();*
>
> this->GetOutputPortInformation(0)->Set(
>
> vtkDataObject::DATA_EXTENT_TYPE(), *newOutput->GetExtentType()*);
>
>
> Am I missing something here?
>
> Thanks,Paul
>
> 2009/8/25 Jeff Baumes <jeff.baumes at kitware.com>
>
>
>> On Tue, Aug 25, 2009 at 8:43 AM, Paul Edwards <paul.m.edwards at gmail.com>wrote:
>>
>>> Is there a reason why Delete is called before GetExtentType?  Or is this
>>> a bug? (although it doesn't crash on me....)
>>>
>>
>> SetPipelineInformation will cause the information object to increment the
>> reference count of the data object. Thus calling Delete will safely
>> decrement the reference count without yet releasing the memory (this matches
>> the reference created by NewInstance()). This is necessary or else a
>> reference will be floating and the object will never be deleted.
>> Jeff
>>
>>
>
> _______________________________________________
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090825/a209bffd/attachment.htm>


More information about the ParaView mailing list