Re: GNOME CVS: libbonobo michael
- From: Michael Meeks <michael ximian com>
- To: jacob berkman <jacob ximian com>
- Cc: Havoc Pennington <hp redhat com>, <gnome-components-list gnome org>
- Subject: Re: GNOME CVS: libbonobo michael
- Date: Sun, 4 Nov 2001 17:36:58 -0500 (EST)
Hi Jacob,
On 2 Nov 2001, jacob berkman wrote:
> the problem is that you just want to be lazy, and this loses a way to
> find problems.
This looses a way to get tedious and bogus warnings.
> and as havoc demonstrated, it's possible to do what you want to do,
> without this lazy hack, in the same amount of code as with it.
Ok - this is _most_ useful because in the new world of GObject you
get to be disposed multiple times ( quite right ), so you should release
your references there - so eg. you can have:
[Jacob Berkman]
if (a->pb)
bonobo_object_unref (a->pb);
a->pb = NULL;
repeat ad nauseum for all of the dispose routine; or
[Michael Meeks]
a->pb = bonobo_objref_unref (a->pb);
So you can actualy read the dispose method in a single glance.
> this loses a debug case where you are unref'ing a NULL object, which
> you surely shouldn't be doing (just like you shouldn't be showing a
> NULL GtkWindow).
Sure - preconditions are valuable; but disposes get run at least
twice, and possible a lot more. Similarly, doing a 'set' of an object
property often involves a dup, and NULL is a quite valid option for a
'set' often - if it isn't a pre-condition is adequate, appropriate and
explicitely documents this - instead of 'just knowing' that a _ref doesn't
allow a NULL pointer.
> programming with gobject/bonobo is already confusing enough without
> different ref/unref semantics.
This is the same semantic as bonobo_object_release_unref / dup_ref
has had almost forever. It shrinks code and I've seen this kill bugs where
people forget to get the ordering write or write the extra lines to deal
with the CORBA_OBJECT_NIL case.
> what would it take for you to reconsider this change?
Some convincing arguments ;-) especialy since I've seen this very
change remove bugs from code I'd written relatively carefully [ which
sucks to admit ].
Regards,
Michael.
--
mmeeks gnu org <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]