Embeddable Musings



I tripped over a little buglet today that I think may point to some
larger issues with embeddables.

The Embeddable::createView method dereferences the view_factory without
checking for NULL. This makes my new Shape embeddables go boom, since
they don't support view creation.  The createCanvasItem method checks
the item_creator and returns a CORBA_OBJECT_NIL when a creator isn't
specified.  I believe at the very least, the createView method should do
the same since ViewFactories are optional in the current API.  

However, wouldn't both of these scenarios warrant an exception instead
of just returning NIL?  The fact that these are optional functionalities
makes me wonder if they should instead be in separate interfaces,
though.  Simply returning NIL doesn't seem an adequate implementation of
the interface method.  :-)  

This extends to pre-activation querying of embeddables.  If I'm writing
a canvas-based app, I need to be able to determine at query time if an
implementation of a set of interfaces supports canvas items.  Likewise,
if I don't have a canvas in my app, I certainly wouldn't want to
activate an embeddable that only supports my requested interfaces via
canvas items.

I can provide a patch for the segfault in createView once I pick up
gnome-vfs and catch up to bonobo HEAD.  :-)  Anyone have any comments on
the interface issue?

Mike




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