Re: [g-a-devel]active-descendant-changed signal and at-spi
- From: Bill Haneman <bill haneman sun com>
- To: "Padraig O'Briain" <Padraig Obriain sun com>
- Cc: michael ximian com, gnome-accessibility-devel gnome org
- Subject: Re: [g-a-devel]active-descendant-changed signal and at-spi
- Date: 05 Dec 2002 14:41:26 +0000
based on a quick chat, I think Michael prefers the following patch:
(which adds cspi_object_take(), a method for converting a
CORBA_reference to a valid "Accessible*" if possible).
I see no attractive alternative to converting the object references in
the CORBA_Any to real refs (incurring a roundtrip) since:
* the listening client will presumably want to call API on the
Accessible after obtaining it, anyhow, thus it needs a ref();
* the listening client can't otherwise be sure that the object ref is
alive, since even within the event delivery loop there are cases where
the object might have been asynchronously delivered (for instance, the
Java bridge must queue its notifications);
* if the EventFoo_getObjectFoo methods use "borrow" instead of "take",
listeners would have to call "cspi_object_return" afterwards, which
would entail introducing new client object-handling rules.
-Bill
Index: cspi/spi-private.h
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi-private.h,v
retrieving revision 1.10
diff -u -r1.10 spi-private.h
--- cspi/spi-private.h 22 Nov 2002 14:07:55 -0000 1.10
+++ cspi/spi-private.h 5 Dec 2002 14:39:14 -0000
@@ -56,6 +56,7 @@
void cspi_object_ref (Accessible *accessible);
void cspi_object_unref (Accessible *accessible);
Accessible *cspi_object_borrow (CORBA_Object corba_object);
+Accessible *cspi_object_take (CORBA_Object corba_object);
void cspi_object_return (Accessible *accessible);
SPIBoolean cspi_accessible_is_a (Accessible *accessible,
const char *interface_name);
Index: cspi/spi_event.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi_event.c,v
retrieving revision 1.25
diff -u -r1.25 spi_event.c
--- cspi/spi_event.c 22 Nov 2002 14:54:59 -0000 1.25
+++ cspi/spi_event.c 5 Dec 2002 14:39:15 -0000
@@ -352,11 +352,12 @@
cspi_internal_event_get_object (const InternalEvent *e)
{
CORBA_any *any;
+ Accessible *accessible;
g_return_val_if_fail (e, NULL);
g_return_val_if_fail (e->data, NULL);
any = (CORBA_any *) e->data;
if (any->_type == TC_CORBA_Object)
- return cspi_object_add (* (CORBA_Object *) any->_value);
+ return cspi_object_take (* (CORBA_Object *) any->_value);
else
return NULL;
}
Index: cspi/spi_main.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi_main.c,v
retrieving revision 1.29
diff -u -r1.29 spi_main.c
--- cspi/spi_main.c 3 Oct 2002 14:29:40 -0000 1.29
+++ cspi/spi_main.c 5 Dec 2002 14:39:16 -0000
@@ -243,6 +243,25 @@
}
}
+Accessible *
+cspi_object_take (CORBA_Object corba_object)
+{
+ Accessible *accessible;
+ accessible = cspi_object_borrow (corba_object);
+ cspi_object_ref (accessible->objref);
+ /*
+ * if the remote object is dead,
+ * cspi_object_return will throw an exception.
+ */
+ cspi_object_return (accessible->objref);
+ if (cspi_exception ())
+ {
+ cspi_object_unref (accessible->objref);
+ accessible = NULL;
+ }
+ return accessible;
+}
+
void
cspi_object_ref (Accessible *accessible)
{
Index: cspi/bonobo/cspi-bonobo.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/bonobo/cspi-bonobo.c,v
retrieving revision 1.7
diff -u -r1.7 cspi-bonobo.c
--- cspi/bonobo/cspi-bonobo.c 13 Sep 2002 13:08:59 -0000 1.7
+++ cspi/bonobo/cspi-bonobo.c 5 Dec 2002 14:39:16 -0000
@@ -29,7 +29,7 @@
CORBA_Object
cspi_dup_ref (CORBA_Object object)
{
- return bonobo_object_dup_ref (object, NULL);
+ return bonobo_object_dup_ref (object, cspi_ev ());
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]