[vtkusers] Unregister(QObjectBase *) vs Delete()
Bill Lorensen
bill.lorensen at gmail.com
Wed Jun 23 08:03:42 EDT 2010
There is really no difference.
Look at the source code for ::Delete and ::UnRegister in Common/vtkObjectBase.
The documentation for UnRegister says:
// Description:
// Decrease the reference count (release by another object). This
// has the same effect as invoking Delete() (i.e., it reduces the
// reference count by 1).
virtual void UnRegister(vtkObjectBase* o);
On Wed, Jun 23, 2010 at 5:38 AM, Barth, Sebastian
<sebastian.barth at iosb.fraunhofer.de> wrote:
> Hello vtkusers,
>
> I tried to find out what is the difference between Unregister(QObjectBase *) and Delete() - Without success.
> Could you please explain?
>
> What I know about reference counting (please correct me):
>
> vtkPolyDataMapper * mapperA = vtkPolyDataMapper::New(); // Reference count of mapperA = 1.
> vtkPolyDataMapper * mapperB = vtkPolyDataMapper::New(); // Reference count of mapperB = 1.
>
> actor->SetMapper(mapperA); // Reference count of mapperA = 2 (or maybe more?)
> actor->SetMapper(mapperB); // Reference count of mapperA = 1,
> // mapperB = 2 (or maybe more?)
>
> mapperA->Delete(); // Reference count of mapper A - 1 = 0 -> deleted
>
> Is this code above a correct way or is it illegal for the pipeline?
> What happens if I call mapperB->Unregister(0) ?
> Where is difference between Unregister(..) and Delete()?
>
> Thanks a lot,
>
> Sebastian Barth
>
>
> _______________________________________________
> 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