Re: [g-a-devel] Need ATK experienced help
- From: "Quiring, Sam" <Sam Quiring windriver com>
- To: "Marcus von Appen" <mva sysfault org>, "g-a-devel" <gnome-accessibility-devel gnome org>
- Subject: Re: [g-a-devel] Need ATK experienced help
- Date: Wed, 2 Sep 2009 16:17:20 -0700
I have found the problem. I was missing a call of g_object_ref()
on the child AtkObject returned by ref_child.
When I saw Marcus's email below, it reminded me that I have modified
_class_ref_child to call into the Python object to dynamically create
the child. When I added the g_object_ref() call, everything works.
-Sam
-----Original Message-----
From: gnome-accessibility-devel-bounces gnome org
[mailto:gnome-accessibility-devel-bounces gnome org] On Behalf Of Marcus
von Appen
Sent: Wednesday, September 02, 2009 1:36 PM
To: g-a-devel
Subject: Re: [g-a-devel] Need ATK experienced help
On, Wed Sep 02, 2009, Li Yuan wrote:
> Hi Quiring,
>
> How did you implement ref_child function? Is there a cache?
The AtkObjectClass ref_child function hook looks like this:
void
atkobjectclass_init (AtkObjectClass *class)
{
debug ("Hooking AtkObjectClass interfaces.\n");
class->get_n_children = _class_get_n_children;
class->ref_child = _class_ref_child;
class->get_index_in_parent = _class_get_index_in_parent;
class->ref_state_set = _class_ref_state_set;
}
static AtkObject*
_class_ref_child (AtkObject *obj, int i)
{
AtkObject *val = NULL;
GList *list = NULL;
debug ("_class_ref_child\n");
list = g_object_get_data (G_OBJECT (obj), PAPI_CHILDREN);
if (list)
{
val = g_list_nth_data (list, (guint) i);
if (!val)
return NULL;
}
if (val)
g_object_ref (val);
return val;
}
AtkObject instances are created with an initial refcount of 1:
...
if (ifaces == IFACE_INVALID)
self->obj = g_object_new (ATK_TYPE_OBJECT, NULL);
else
self->obj = g_object_new (atktype_get_type (ifaces), NULL);
where self->obj is a AtkObject* pointer and ifaces/IFACE_INVALID a
bitwise
AtkInterfaceType combination.
AtkObject instances are valid as long as there is an encapsulating
Python object, so the ref count never should go down within the
application code in an unexpected or unintended manner.
Regards
Marcus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]