[PATCH] Add missing call to g_type_init()

Aaron Ecay aaronecay at gmail.com
Mon Jul 25 16:38:58 PDT 2011


The Glib docs state "Prior to any use of the type system, g_type_init() has to
be called".[1] To not do so can lead to segfaults.  The g_type system is
currently used by various "filters" that operate on uuencoded text, message
headers, etc.

[1] http://developer.gnome.org/gobject/2.28/gobject-Type-Information.html#g-type-init

---

I have added a link to the Glib docs to the commit message, and a description
of where the type code is used.  There isn't an easy way to test for this bug,
I think -- not including the init call is wrong by the API docs, but only
sometimes yields a crash.

 notmuch.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/notmuch.c b/notmuch.c
index 3973e35..f9d6629 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -579,6 +579,7 @@ main (int argc, char *argv[])
     local = talloc_new (NULL);
 
     g_mime_init (0);
+    g_type_init ();
 
     if (argc == 1)
 	return notmuch (local);
-- 
1.7.6



More information about the notmuch mailing list