[glib/wip/gcleanup: 40/78] gtypemodule: Allow GTypeModule to be finalized
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup: 40/78] gtypemodule: Allow GTypeModule to be finalized
- Date: Tue, 12 Nov 2013 05:30:29 +0000 (UTC)
commit ebbaa97732c21c68e2632316c5c69b574600571a
Author: Stef Walter <stefw gnome org>
Date: Thu Nov 7 22:56:11 2013 +0100
gtypemodule: Allow GTypeModule to be finalized
This is used by the cleanup code.
https://bugzilla.gnome.org/show_bug.cgi?id=711778
gobject/gtypemodule.c | 12 ++++++------
gobject/tests/dynamictests.c | 10 ++++++++++
2 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c
index 25ec75d..5ba629c 100644
--- a/gobject/gtypemodule.c
+++ b/gobject/gtypemodule.c
@@ -105,13 +105,13 @@ static void
g_type_module_dispose (GObject *object)
{
GTypeModule *module = G_TYPE_MODULE (object);
-
- if (module->type_infos || module->interface_infos)
- {
- g_warning (G_STRLOC ": unsolicitated invocation of g_object_run_dispose() on GTypeModule");
- g_object_ref (object);
- }
+ /* The types themselves will be cleaned up separately */
+ g_slist_free_full (module->type_infos, g_free);
+ module->type_infos = NULL;
+
+ g_slist_free_full (module->interface_infos, g_free);
+ module->interface_infos = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
diff --git a/gobject/tests/dynamictests.c b/gobject/tests/dynamictests.c
index 86dcdf3..9710f57 100644
--- a/gobject/tests/dynamictests.c
+++ b/gobject/tests/dynamictests.c
@@ -223,6 +223,8 @@ test_multithreaded_dynamic_type_init (void)
for (i = 0; i < N_THREADS; i++) {
g_thread_join (threads[i]);
}
+
+ g_object_unref (module);
}
enum
@@ -344,6 +346,7 @@ static void
test_dynamic_interface_properties (void)
{
GTypeModule *module;
+ gpointer check;
DynObj *obj;
gint val;
@@ -354,7 +357,14 @@ test_dynamic_interface_properties (void)
g_object_get (obj, "foo", &val, NULL);
g_assert_cmpint (val, ==, 1);
+ check = obj;
+ g_object_add_weak_pointer (check, &check);
+
g_object_unref (obj);
+
+ g_assert (check == NULL);
+
+ g_object_unref (module);
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]