AW: [Insight-users] Why is itkDataObject::m_Source a WeakPointer?
Th. Boettger
t.boettger@dkfz-heidelberg.de
Fri, 11 Oct 2002 19:03:38 +0200
Well okay. This surely is true.
But how can I avoid the problem described below?
> -----Ursprüngliche Nachricht-----
> Von: Miller, James V (Research) [mailto:millerjv@crd.ge.com]
> Gesendet: Freitag, 11. Oktober 2002 18:54
> An: 'Th. Boettger'; ITK Mailing List
> Betreff: RE: [Insight-users] Why is itkDataObject::m_Source a
> WeakPointer?
>
>
> The source is a WeakPointer because the Source points to the
> DataObject and
> the DataObject points to the Source. If they both held
> SmartPointers to each
> other, then we would have a cyclic reference loop and neither the
> Source or the
> DataObject could ever be deleted.
>
>
>
> > -----Original Message-----
> > From: Th. Boettger [mailto:t.boettger@dkfz-heidelberg.de]
> > Sent: Friday, October 11, 2002 12:25 PM
> > To: ITK Mailing List
> > Subject: [Insight-users] Why is itkDataObject::m_Source a WeakPointer?
> >
> >
> > Hi all,
> >
> > I am trying to construct a filter pipeline in a member function and to
> > return the resulting data object *without* calling Update()
> > in this method.
> > When trying to update the returned data object outside, the
> > source is set to
> > NULL. The reason is that m_Source member is defined as a weak
> > pointer, thus
> > the reference count of the process objects (the source) is
> > not incremented.
> >
> > Why is it a WeakPointer? How can I avoid this problem?
> >
> > class itkDataObject
> > {
> > ...
> > mutable WeakPointer<ProcessObject> m_Source;
> > ...
> > }
> >
> > Thanks in advance!
> >
> >
> >
> > ---
> > Dipl.-Inform. Thomas Boettger
> > Deutsches Krebsforschungszentrum (German Cancer
> > Research Center)
> > Div. Medical and Biological Informatics H0100 Tel: (+49)
> > 6221-42 2328
> > Im Neuenheimer Feld 280 Fax: (+49)
> > 6221-42 2345
> > D-69120 Heidelberg e-mail:
> > t.boettger@dkfz.de
> > Germany
> http://www.dkfz.de/mbi/people/thomasb.shtml
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>