diff options
author | Mike Gorse <mgorse@suse.com> | 2014-07-19 16:26:52 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@suse.com> | 2014-07-19 16:26:52 -0500 |
commit | f33fd585e1e18eacec271582ffb9956965a4f146 (patch) | |
tree | c8025449fe3696c8e0af6f80ec7115c70f79d1cf | |
parent | be5a14c9c8507c5b67868c89c5442cc9ba1160aa (diff) | |
download | at-spi2-core-f33fd585e1e18eacec271582ffb9956965a4f146.tar.gz |
Fix lifecycle of an accessible's cache
When a cache is referenced in response to an event, it is supposed
to be unref'd after the event handler has been called.
-rw-r--r-- | atspi/atspi-accessible.c | 3 | ||||
-rw-r--r-- | atspi/atspi-event-listener.c | 2 | ||||
-rw-r--r-- | atspi/atspi-misc-private.h | 2 | ||||
-rw-r--r-- | atspi/atspi-misc.c | 4 |
4 files changed, 7 insertions, 4 deletions
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index 23aad908..b294a5d1 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -190,7 +190,8 @@ atspi_accessible_finalize (GObject *object) if (accessible->attributes) g_hash_table_unref (accessible->attributes); - _atspi_accessible_unref_cache (accessible); + if (accessible->priv->cache) + g_hash_table_destroy (accessible->priv->cache); #ifdef DEBUG_REF_COUNTS accessible_count--; diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c index 09ccfd30..292e88ba 100644 --- a/atspi/atspi-event-listener.c +++ b/atspi/atspi-event-listener.c @@ -1038,7 +1038,7 @@ _atspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message, void *data) if (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY) { /* new form -- parse properties sent with event */ - _atspi_dbus_update_cache_from_dict (e.source, &iter); + cache = _atspi_dbus_update_cache_from_dict (e.source, &iter); } if (!strncmp (e.type, "object:children-changed", 23)) diff --git a/atspi/atspi-misc-private.h b/atspi/atspi-misc-private.h index cd472b07..fe5ca561 100644 --- a/atspi/atspi-misc-private.h +++ b/atspi/atspi-misc-private.h @@ -159,7 +159,7 @@ GHashTable *_atspi_get_live_refs (); gchar *_atspi_name_compat (gchar *in); -void _atspi_dbus_update_cache_from_dict (AtspiAccessible *accessible, DBusMessageIter *iter); +GHashTable *_atspi_dbus_update_cache_from_dict (AtspiAccessible *accessible, DBusMessageIter *iter); gboolean _atspi_get_allow_sync (); diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c index 0492b3f8..f698544a 100644 --- a/atspi/atspi-misc.c +++ b/atspi/atspi-misc.c @@ -1705,7 +1705,7 @@ atspi_role_get_name (AtspiRole role) return NULL; } -void +GHashTable * _atspi_dbus_update_cache_from_dict (AtspiAccessible *accessible, DBusMessageIter *iter) { GHashTable *cache = _atspi_accessible_ref_cache (accessible); @@ -1768,6 +1768,8 @@ _atspi_dbus_update_cache_from_dict (AtspiAccessible *accessible, DBusMessageIter g_hash_table_insert (cache, g_strdup (key), val); dbus_message_iter_next (&iter_dict); } + + return cache; } gboolean |