Re: [Re: [Re: gobject weak references]]



Alex Larsson <alexl redhat com> wrote:
> On 18 Sep 2001, Murray Cumming wrote:
> 
> > Sven Neumann <sven gimp org> wrote:
> > > Hi,
> > > 
> > > Murray Cumming <Murray_Cumming betaresearch de> writes:
> > > 
> > > > Actually I think that your example is a bit hackish. I would prefer
to
> > > > use an ID that's passed through data or is stored in the object's
> > > > quark-data-thing mechanism. If there's no absolute need to use an
> > > > invalid pointer then we shouldn't give people the opportunity.
> > > 
> > > I don't think it is hackish at all. The pointer is not invalid, it's
> > > only not pointing to a functional GObject anymore since the GObject
> > > is in the process of being finalized when the notifier is being called.
> > > Why would you want to add the overhead of an ID mechanism if there
> > > already is a perfectly valid ID, the memory address of the GObject?
> > 
> > Oh, OK, if the memory hasn't been freed yet then I have no problem with
using
> > the pointer.
> 
> In what way does it matter if it has been freed or not?

I wouldn't like an API to encourage the use of invalid pointers because that
increases the chance of segfaults.

Murray Cumming
murrayc usa net
www.murrayc.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]