- Bonobo_Unknown iface;
-
- if (!obj)
- {
- return NULL;
- }
-
- iface = Accessibility_Accessible_queryInterface (CSPI_OBJREF (obj),
- interface_name,
- cspi_ev ());
-
-
- cspi_return_val_if_ev ("queryInterface", NULL);
-
- /*
- * FIXME: we need to be fairly sure that references are going
- * to mach up if we are going to expose QueryInterface, ie. we
- * can't allow people to do:
- * b = a.qi ("b"); b.unref, b.unref to release a's reference.
- * this should be no real problem though for this level of API
- * user.
- */
-
- return cspi_object_add (iface);
+ if (cspi_accessible_is_a (obj, interface_name))
+ {
+ /* The original code called cspi_object_add(obj) instead, but gok and
+ * simple-at don't treat interfaces as references, so I'm confused
+ * and not going to replicate this bit of code */
+ return obj;
+ }
+ return NULL;