[at-spi2-atk] BGO#652858: Deregister objects on state-changed::defunct
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-atk] BGO#652858: Deregister objects on state-changed::defunct
- Date: Thu, 23 Jun 2011 21:06:21 +0000 (UTC)
commit c72a4b4b0330733b2c2e0ed768d76ff85cd31500
Author: Mike Gorse <mgorse novell com>
Date: Thu Jun 23 16:02:49 2011 -0500
BGO#652858: Deregister objects on state-changed::defunct
When a state-change:defunct is received, remove the object from the
dbus-path-to-object-mapping hash. Also, avoid enumerating an object's
children in a call to GetItems if the object is marked defunct. This
should mostly shield the ATK implementation from being called on objects
that have been marked defunct.
Also removed a seemingly unnecessary g_strdup/g_free pair.
atk-adaptor/accessible-cache.c | 3 ++-
atk-adaptor/accessible-register.c | 7 +++++++
atk-adaptor/accessible-register.h | 3 +++
atk-adaptor/adaptors/cache-adaptor.c | 3 ++-
atk-adaptor/event.c | 9 ++++-----
5 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/atk-adaptor/accessible-cache.c b/atk-adaptor/accessible-cache.c
index 79a369f..ad39819 100644
--- a/atk-adaptor/accessible-cache.c
+++ b/atk-adaptor/accessible-cache.c
@@ -275,7 +275,8 @@ add_pending_items (gpointer data)
{
g_queue_push_tail (to_add, current);
if (!spi_cache_in (cache, G_OBJECT (current)) &&
- !atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS))
+ !atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS) &&
+ !atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
{
append_children (current, cache->add_traversal);
}
diff --git a/atk-adaptor/accessible-register.c b/atk-adaptor/accessible-register.c
index 99d98f3..83c1c6d 100644
--- a/atk-adaptor/accessible-register.c
+++ b/atk-adaptor/accessible-register.c
@@ -190,6 +190,13 @@ static void
deregister_object (gpointer data, GObject * gobj)
{
SpiRegister *reg = SPI_REGISTER (data);
+
+ spi_register_deregister_object (reg, gobj);
+}
+
+void
+spi_register_deregister_object (SpiRegister *reg, GObject *gobj)
+{
guint ref;
ref = object_to_ref (gobj);
diff --git a/atk-adaptor/accessible-register.h b/atk-adaptor/accessible-register.h
index 9a65f2a..edbe3c2 100644
--- a/atk-adaptor/accessible-register.h
+++ b/atk-adaptor/accessible-register.h
@@ -72,6 +72,9 @@ spi_register_object_to_ref (GObject * gobj);
gchar *
spi_register_root_object_path ();
+void
+spi_register_deregister_object (SpiRegister *reg, GObject *gobj);
+
/*---------------------------------------------------------------------------*/
#endif /* ACCESSIBLE_REGISTER_H */
diff --git a/atk-adaptor/adaptors/cache-adaptor.c b/atk-adaptor/adaptors/cache-adaptor.c
index 0aff2bd..1f33ce3 100644
--- a/atk-adaptor/adaptors/cache-adaptor.c
+++ b/atk-adaptor/adaptors/cache-adaptor.c
@@ -145,7 +145,8 @@ append_cache_item (AtkObject * obj, gpointer data)
/* Marshall children */
dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "(so)",
&iter_sub_array);
- if (!atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS))
+ if (!atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS) &&
+ !atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
{
gint childcount, i;
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
index e882edf..99c2041 100644
--- a/atk-adaptor/event.c
+++ b/atk-adaptor/event.c
@@ -606,15 +606,14 @@ state_event_listener (GSignalInvocationHint * signal_hint,
guint detail1;
accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- pname = g_strdup (g_value_get_string (¶m_values[1]));
+ pname = g_value_get_string (¶m_values[1]);
- /* TODO - Possibly ignore a change to the 'defunct' state.
- * This is because without reference counting defunct objects should be removed.
- */
detail1 = (g_value_get_boolean (¶m_values[2])) ? 1 : 0;
emit_event (accessible, ITF_EVENT_OBJECT, STATE_CHANGED, pname, detail1, 0,
DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
- g_free (pname);
+
+ if (!g_strcmp0 (pname, "defunct"))
+ spi_register_deregister_object (spi_global_register, G_OBJECT (accessible));
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]