[at-spi2-core] Unref enum type classes when we're done with them
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] Unref enum type classes when we're done with them
- Date: Sun, 20 Jul 2014 17:48:34 +0000 (UTC)
commit 95a025d4468d4841f67f443edb459fd8dec53036
Author: Mike Gorse <mgorse suse com>
Date: Sat Jul 19 15:42:52 2014 -0500
Unref enum type classes when we're done with them
atspi/atspi-misc.c | 2 ++
atspi/atspi-stateset.c | 7 +++++--
2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index aa2fb66..0492b3f 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -1697,6 +1697,8 @@ atspi_role_get_name (AtspiRole role)
retval = g_strdup (value->value_nick);
}
+ g_type_class_unref (type_class);
+
if (retval)
return _atspi_name_compat (retval);
diff --git a/atspi/atspi-stateset.c b/atspi/atspi-stateset.c
index 33c28a7..1f9d993 100644
--- a/atspi/atspi-stateset.c
+++ b/atspi/atspi-stateset.c
@@ -90,13 +90,14 @@ atspi_state_set_set_by_name (AtspiStateSet *set, const gchar *name, gboolean ena
GTypeClass *type_class;
GEnumValue *value;
- type_class = g_type_class_ref (ATSPI_TYPE_STATE_TYPE);
-
if (set->accessible &&
!(set->accessible->cached_properties & ATSPI_CACHE_STATES))
return;
+ type_class = g_type_class_ref (ATSPI_TYPE_STATE_TYPE);
+
value = g_enum_get_value_by_nick (G_ENUM_CLASS (type_class), name);
+
if (!value)
{
g_warning ("AT-SPI: Attempt to set unknown state '%s'", name);
@@ -106,6 +107,8 @@ atspi_state_set_set_by_name (AtspiStateSet *set, const gchar *name, gboolean ena
set->states |= ((gint64)1 << value->value);
else
set->states &= ~((gint64)1 << value->value);
+
+ g_type_class_unref (type_class);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]