diff options
author | Michael Meeks <michael@ximian.com> | 2001-12-10 10:32:45 +0000 |
---|---|---|
committer | Michael Meeks <michael@src.gnome.org> | 2001-12-10 10:32:45 +0000 |
commit | 3b4d67302b815d98710eb30228ddec8ab97f809b (patch) | |
tree | c68ade05211dac3c9b6b6637203319d70091cdab /atk/atkregistry.c | |
parent | b2c738351d09d2c50136a07f3d3a82a5b840b6c1 (diff) | |
download | at-spi2-core-3b4d67302b815d98710eb30228ddec8ab97f809b.tar.gz |
paranoia is not appropriate here, setup parent_class, don't create a new
2001-12-08 Michael Meeks <michael@ximian.com>
* atk/atkregistry.c (atk_registry_class_init):
paranoia is not appropriate here, setup parent_class,
don't create a new default registry here - makes no
sense.
(atk_registry_finalize): chain to parent class, do
g_hash_table_destroys instead of g_frees.
Diffstat (limited to 'atk/atkregistry.c')
-rw-r--r-- | atk/atkregistry.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/atk/atkregistry.c b/atk/atkregistry.c index fda1d5ab..a6598de2 100644 --- a/atk/atkregistry.c +++ b/atk/atkregistry.c @@ -26,8 +26,9 @@ static void atk_registry_init (AtkRegistry *instance AtkRegistryClass *klass); static void atk_registry_finalize (GObject *instance); static void atk_registry_class_init (AtkRegistryClass *klass); +static AtkRegistry* atk_registry_new (void); -static AtkRegistry* atk_registry_new (); +GObjectClass *parent_class; GType atk_registry_get_type (void) @@ -59,14 +60,11 @@ atk_registry_get_type (void) static void atk_registry_class_init (AtkRegistryClass *klass) { - GObjectClass *object_class; + GObjectClass *object_class = (GObjectClass *) klass; - /* is paranoia appropriate in a class initializer ? */ - g_return_if_fail (G_IS_OBJECT_CLASS (klass)); + parent_class = g_type_class_peek_parent (klass); - object_class = G_OBJECT_CLASS (klass); object_class->finalize = atk_registry_finalize; - default_registry = atk_registry_new (); } #if 0 @@ -79,7 +77,7 @@ atk_registry_class_finalize (GObjectClass *klass) { g_return_if_fail (ATK_IS_REGISTRY_CLASS (klass)); - g_free (default_registry); + g_object_unref (G_OBJECT (default_registry)); } #endif @@ -92,8 +90,8 @@ atk_registry_init (AtkRegistry *instance, AtkRegistryClass *klass) (GEqualFunc) NULL); } -static AtkRegistry* -atk_registry_new () +static AtkRegistry * +atk_registry_new (void) { GObject *object; @@ -105,14 +103,14 @@ atk_registry_new () } static void -atk_registry_finalize (GObject *instance) +atk_registry_finalize (GObject *object) { - AtkRegistry *registry; + AtkRegistry *registry = ATK_REGISTRY (object); - g_return_if_fail (ATK_IS_REGISTRY (instance)); - registry = ATK_REGISTRY (instance); - g_free (registry->factory_type_registry); - g_free (registry->factory_singleton_cache); + g_hash_table_destroy (registry->factory_type_registry); + g_hash_table_destroy (registry->factory_singleton_cache); + + parent_class->finalize (object); } /** @@ -263,11 +261,11 @@ atk_registry_get_factory (AtkRegistry *registry, * registry **/ AtkRegistry* -atk_get_default_registry () +atk_get_default_registry (void) { if (!default_registry) - { - default_registry = atk_registry_new(); - } + { + default_registry = atk_registry_new (); + } return default_registry; } |