[gmime/gmime-2-2] Don't register an atexit() handler
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime/gmime-2-2] Don't register an atexit() handler
- Date: Fri, 26 Mar 2010 14:33:26 +0000 (UTC)
commit 214b79d69b3b2aaa41935682bbc43adb9e5db5ba
Author: Jeffrey Stedfast <fejj gnome org>
Date: Fri Mar 26 10:32:48 2010 -0400
Don't register an atexit() handler
2010-03-26 Jeffrey Stedfast <fejj novell com>
Fixes for bug #613653
* gmime/gmime.c (g_mime_init): Initialize GMimeObject's type
registry.
(g_mime_shutdown): Shut it down here.
* gmime/gmime-object.c (g_mime_object_type_registry_init):
* Renamed
a bit and fixed to not use g_atexit(). Also made
internal-public.
(g_mime_object_type_registry_shutdown): Renamed and made
internal-public.
(g_mime_object_register_type): Don't init the type system
anymore.
(g_mime_object_new_type): Same here.
ChangeLog | 15 +++++++++++++++
autogen.sh | 3 +++
gmime/gmime-object.c | 19 +++++--------------
gmime/gmime-object.h | 4 ++++
gmime/gmime.c | 2 ++
5 files changed, 29 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bb9b614..08c0e18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-26 Jeffrey Stedfast <fejj novell com>
+
+ Fixes for bug #613653
+
+ * gmime/gmime.c (g_mime_init): Initialize GMimeObject's type
+ registry.
+ (g_mime_shutdown): Shut it down here.
+
+ * gmime/gmime-object.c (g_mime_object_type_registry_init): Renamed
+ a bit and fixed to not use g_atexit(). Also made internal-public.
+ (g_mime_object_type_registry_shutdown): Renamed and made
+ internal-public.
+ (g_mime_object_register_type): Don't init the type system anymore.
+ (g_mime_object_new_type): Same here.
+
2010-01-30 Jeffrey Stedfast <fejj novell com>
* README: Bumped version
diff --git a/autogen.sh b/autogen.sh
index b14f5ad..e871495 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -54,6 +54,9 @@ elif automake-1.9 --version < /dev/null > /dev/null 2>&1 ; then
elif automake-1.10 --version < /dev/null > /dev/null 2>&1 ; then
AUTOMAKE=automake-1.10
ACLOCAL=aclocal-1.10
+elif automake-1.11 --version < /dev/null > /dev/null 2>&1 ; then
+ AUTOMAKE=automake-1.11
+ ACLOCAL=aclocal-1.11
else
echo
echo "You must have automake 1.8.x installed to compile $PROJECT."
diff --git a/gmime/gmime-object.c b/gmime/gmime-object.c
index 3b29909..ec209f7 100644
--- a/gmime/gmime-object.c
+++ b/gmime/gmime-object.c
@@ -69,8 +69,6 @@ static ssize_t write_to_stream (GMimeObject *object, GMimeStream *stream);
static ssize_t write_content_type (GMimeStream *stream, const char *name, const char *value);
-static void type_registry_init (void);
-
static GHashTable *type_hash = NULL;
@@ -119,8 +117,6 @@ g_mime_object_class_init (GMimeObjectClass *klass)
klass->set_content_type = set_content_type;
klass->get_headers = get_headers;
klass->write_to_stream = write_to_stream;
-
- type_registry_init ();
}
static void
@@ -233,8 +229,6 @@ g_mime_object_register_type (const char *type, const char *subtype, GType object
g_return_if_fail (subtype != NULL);
g_return_if_fail (type != NULL);
- type_registry_init ();
-
if (!(bucket = g_hash_table_lookup (type_hash, type))) {
bucket = g_new (struct _type_bucket, 1);
bucket->type = g_strdup (type);
@@ -282,8 +276,6 @@ g_mime_object_new_type (const char *type, const char *subtype)
g_return_val_if_fail (type != NULL, NULL);
- type_registry_init ();
-
if ((bucket = g_hash_table_lookup (type_hash, type))) {
if (!(sub = g_hash_table_lookup (bucket->subtype_hash, subtype)))
sub = g_hash_table_lookup (bucket->subtype_hash, "*");
@@ -724,20 +716,19 @@ type_bucket_foreach (gpointer key, gpointer value, gpointer user_data)
g_free (bucket);
}
-static void
-type_registry_shutdown (void)
+void
+g_mime_object_type_registry_shutdown (void)
{
g_hash_table_foreach (type_hash, type_bucket_foreach, NULL);
g_hash_table_destroy (type_hash);
+ type_hash = NULL;
}
-static void
-type_registry_init (void)
+void
+g_mime_object_type_registry_init (void)
{
if (type_hash)
return;
type_hash = g_hash_table_new (g_mime_strcase_hash, g_mime_strcase_equal);
-
- g_atexit (type_registry_shutdown);
}
diff --git a/gmime/gmime-object.h b/gmime/gmime-object.h
index 31efa5b..347da81 100644
--- a/gmime/gmime-object.h
+++ b/gmime/gmime-object.h
@@ -108,6 +108,10 @@ char *g_mime_object_get_headers (GMimeObject *object);
ssize_t g_mime_object_write_to_stream (GMimeObject *object, GMimeStream *stream);
char *g_mime_object_to_string (GMimeObject *object);
+/* Internal API */
+G_GNUC_INTERNAL void g_mime_object_type_registry_init (void);
+G_GNUC_INTERNAL void g_mime_object_type_registry_shutdown (void);
+
G_END_DECLS
#endif /* __GMIME_OBJECT_H__ */
diff --git a/gmime/gmime.c b/gmime/gmime.c
index a765d28..6c2afd5 100644
--- a/gmime/gmime.c
+++ b/gmime/gmime.c
@@ -105,6 +105,7 @@ g_mime_init (guint32 flags)
gmime_error_quark = g_quark_from_static_string ("gmime");
/* register our default mime object types */
+ g_mime_object_type_registry_init ();
g_mime_object_register_type ("*", "*", g_mime_part_get_type ());
g_mime_object_register_type ("multipart", "*", g_mime_multipart_get_type ());
g_mime_object_register_type ("multipart", "encrypted", g_mime_multipart_encrypted_get_type ());
@@ -128,6 +129,7 @@ g_mime_shutdown (void)
if (--initialized)
return;
+ g_mime_object_type_registry_shutdown ();
g_mime_charset_map_shutdown ();
g_mime_iconv_shutdown ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]