Re: GNOME CVS: libbonobo michael



In that case, wouldn't it be kinda nifty to have bonobo_object_unref be
a macro that unref'd the object and set it to NULL?

I don't particularly care either way, but it would be kinda cool...

I'll go off and jump in at another random point in time without having a
clue as to what the discussion is really about, have no fear :-)

Jeff

On Wed, 2001-10-31 at 21:49, Michael Meeks wrote:
> 
> Hi Jacob,
> 
> On 31 Oct 2001, jacob berkman wrote:
> > and this doesn't make BonoboObject and GObject behave differently wrt
> > ref/unref of NULL objects (which i really this is a horrible idea,
> > hence my replying to the commit).
> 
>         I'm not sure I understand the reasons behind your problem with
> that - if you wish to do:
> 
> typedef JACOB_UNREF(o) \
>         if (o != NULL) \
>                 bonobo_object_unref (o); \
>         else \
>                 g_warning ("Something horrifying happened");
> 
>         Then go for it; I don't believe it actualy adds any value to
> anything. If you're particularly worried about a method being passed NULL
> values when it shouldn't be, then pre-conditions are the right solution.
> 
>         I imagine in the absence of a pre-condition it is sensible to
> assume that a value can be NULL. Oh ... and since the unref returns NULL
> you can also do ( in your dispose [1] ):
> 
>         a->priv->obj = bonobo_object_unref (a->priv->obj);
> 
>         instead of:
> 
>         if (a->priv->obj) {
>                 bonobo_object_unref (a->priv->obj);
>                 a->priv->obj = NULL;
>         }
> 
>         or whatever else contorted flow you like ;-) really it's just an
> analogue of the equivalent for CORBA_OBJECT_NIL in
> bonobo_object_release_unref etc. that has saved many loc & potential bugs.
> 
>         Regards,
> 
>                 Michael.
> 
> [1] - which will be called multiple times.
> 
> -- 
>  mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot
> 
> _______________________________________________
> gnome-components-list mailing list
> gnome-components-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-components-list





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