Re: Bonobo::Unknown
- From: Maciej Stachowiak <mjs eazel com>
- To: Mathieu Lacage <lacage email enst fr>
- Cc: gnome-components-list gnome org
- Subject: Re: Bonobo::Unknown
- Date: 24 Apr 2000 08:37:08 -0700
Mathieu Lacage <lacage@email.enst.fr> writes:
> Maciej Stachowiak <mjs@eazel.com> writes:
>
>
> >
> > > Also, imagine I have A, B and C with interfaces IA, IB, and IC.
> > >
> > > I make:
> > > bonobo_object_add_interface (A, B)
> > > bonobo_object_add_interface (A, C)
> > > B = bonobo_object_QI (A, IB)
> > > bonobo_object_QI (B, IC) ------> this will not return C.
> > >
> > > object B does not know about object C.
> >
> > That is not correct. the final expression in your list above _will_
> > return C. `query_interface' is reflexive, transitive, and symmetric,
> > i.e. it is an equivalence relation.
>
> I know what QI is supposed to do and what its properties are supposed to be.
> My point is that the current implementation does not look like it works in
> the case described above.
Did you try it?
> look at the folowing:
>
> for (l = newobj->priv->ao->objs; l; l = l->next) {
> if (!g_list_find (object->priv->ao->objs, l->data)) {
> object->priv->ao->objs = g_list_prepend (object->priv->ao->objs, l->data);
> ((BonoboObject *)l->data)->priv->ao = object->priv->ao;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }
> }
>
> If you use this code to merge A and B and then to merge A and C,
> A's linked list will be updated together with C's one but
> the B linked list will not be updated. B will still hold a pointer
> to the old linked list (which is gfree'd actually, so, we may have
> a segfault)
The line of code I have marked sets the priv->ao field of every object
in B's AggregateObject (which includes a pointer back to B itself) to
A's priv->ao field. The `ao' struct pointer contains the `objs' linked
list of interface pointers, so A and B will always share linked lists
no matter how they get changed. In fact you could say that object
identity in the libbonobo Bonobo::Unknown implementation is having
equal ao pointers.
> Unless I missed something really important, I doubt I am wrong.
>
I think you did, but the code is pretty unclear. Perhaps the line I
marked should be commented.
In the future it might be a good idea to test such things before
reporting bugs. :-)
- Maciej
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]