diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-08-25 16:28:24 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-08-25 16:28:24 +0200 |
commit | 8b81f14a1e46504d37272f00662a3fb2e2d8adab (patch) | |
tree | e7479518d920e46d7e0bbac349ac3c2a6e52e488 /atspi/atspi-accessible.c | |
parent | 00bb7be3d6d33cac059597f48526397cf46e448b (diff) | |
download | at-spi2-core-8b81f14a1e46504d37272f00662a3fb2e2d8adab.tar.gz |
atspi_accessible_dispose: Avoid unreferencing NULL
The children array may contain NULL entries, when the children have not
all been inspected yet for instance. In such a case
atspi_accessible_dispose's call to g_ptr_array_free would warn out when
freeing array items with g_object_unref. We should thus check for NULL
to avoid such warning.
Diffstat (limited to 'atspi/atspi-accessible.c')
-rw-r--r-- | atspi/atspi-accessible.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index 0f3c7f77..8c60b288 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -163,6 +163,13 @@ static gint accessible_count = 0; #endif static void +atspi_accessible_unref (GObject *accessible) +{ + if (accessible != NULL) + g_object_unref(accessible); +} + +static void atspi_accessible_init (AtspiAccessible *accessible) { #ifdef DEBUG_REF_COUNTS @@ -173,7 +180,7 @@ atspi_accessible_init (AtspiAccessible *accessible) accessible->priv = atspi_accessible_get_instance_private (accessible); - accessible->children = g_ptr_array_new_with_free_func (g_object_unref); + accessible->children = g_ptr_array_new_with_free_func (atspi_accessible_unref); } static void |