Re: refcount checking in add_interface
- From: Nat Friedman <nat helixcode com>
- To: Maciej Stachowiak <mjs eazel com>
- Cc: gnome-components-list gnome org
- Subject: Re: refcount checking in add_interface
- Date: 29 Mar 2000 07:16:57 -0500
Please add this check back.
Or, if you want to go a step further, you can enforce the actual
invariant which matters; that is, after someone QI's for an interface,
we must always give the same answer in the future. The invariant is:
If QI (component, "interface") returns a valid interface, it must
always return a valid interface. If QI (component, "interface")
returns NIL, it must always return NIL.
So, to enforce the invariant, we can keep a hash table of interfaces
which have been requested, and store whether or not we returned an
interface. Then, in the future, we bail if the component implementor
tries to change the list of supported interfaces in a way which the
user might be able to notice.
Actually, it's worse than that, because you might be aggregating two
objects which have *both* already been exposed. So at aggregation
time you also have to check the hash tables against each other and
make sure there's no mismatch. Then you have to merge them.
This gets pathologically complex. Which is why we have that simple,
naive check in there.
Nat
Maciej Stachowiak <mjs@eazel.com> writes:
> Elliot checked in the following change a while back. I remember it was
> objected to on-list and I don't recall seeing a good justification for
> it.
>
> I will revert it tomorrow unless someone objects. (In other words, I
> will add back the checks that correspond to the comment, which is
> still there).
>
>
> [mjs@pythagoras bonobo]$ cvs diff -u -r 1.49 -r 1.48 bonobo-object.c
> Index: bonobo-object.c
> ===================================================================
> RCS file: /cvs/gnome/bonobo/bonobo/bonobo-object.c,v
> retrieving revision 1.49
> retrieving revision 1.48
> diff -u -r1.49 -r1.48
> --- bonobo-object.c 1999/12/13 23:15:22 1.49
> +++ bonobo-object.c 1999/12/10 06:35:42 1.48
> @@ -474,6 +474,8 @@
> *
> * This check is not perfect, but might help some people.
> */
> + g_return_if_fail (object->priv->ao->ref_count == 1);
> + g_return_if_fail (newobj->priv->ao->ref_count == 1);
>
> oldao = newobj->priv->ao;
>
>
>
> --
> FAQ: Frequently-Asked Questions at http://www.gnome.org/gnomefaq
> To unsubscribe: mail gnome-components-list-request@gnome.org with
> "unsubscribe" as the Subject.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]