Re: BonoboGenericFactory for GNOME 2



Martin Baulig <martin home-of-linux org> writes:

> 
> Basically, we have two "problems" here:
> 
> a) BonoboGenericFactory is using GNOME_ObjectFactory which is
>    not a Bonobo::Unknown.
> 
> b) GNOME_ObjectFactory is part of OAF and as such also useful for
>    non-Bonobo code
> 

I'd actually really like to make GNOME::ObjectFactory inherit from
Bonobo::Unknown for GNOME 2 because all interfaces should inherit from
Bonobo::Unknown to maximize reusability. I don't actually have a
problem with depending on the Bonobo IDL, but I do have a problem with
depending on libbonobo because libbonobo depends on oaf, so this would
create a circular dependency.

Two possible solutions to this problem include:

* Split off the IDL into a separate module (don't know how the bonobo
  maintainers feel about this)

* Merge OAF and Bonobo (unlikly to pass muster with oaf and bonobo
  maintainers I'd imagine)

> 1.) First of all, we need to ask Maciej to either rename or remove the
>     `ref' and `unref' methods in GNOME::ObjectFactory (from a `grep -r'
>     in oaf, they don't seem to be used at all).

They're not used right now, but the intent was to use these to make
life cycle management of factories a bit more sane and remove some
race conditions. The base OAF version of the interface needs to have
ref and unref methods to make this work out.

> 2.) After that, we create a Bonobo::GenericFactory which derives from
>     both GNOME::ObjectFactory and Bonobo::Unknown

One problem with defining an interface that inherits from
Bonobo::Unknown and an interface that does not inherit from Unknown is
that it violates the rules of queryInterface. If you have an interface
reference A of type "IDL:A:1.0" which also has an interface
"IDL:B:1.0", then it should be the case that:

A.queryInterface("IDL:B:1.0").queryInterface("IDL:A:1.0") == A

However, if B is an interface that does not inherit from
Bonobo::Unknown, this is impossible. Thus, it's a bad idea to do this.

It really would make everyone's life much easier if the OAF factory
interface could just inherit from Bonobo::Unknown (much as
IClassFactory inherits from IUnknown in Microsoft COM).

-- 
Maciej Stachowiak
Eazel, Inc.




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