]> git.notmuchmail.org Git - notmuch/commitdiff
lib: call g_type_init from notmuch_database_open
authorDavid Bremner <bremner@debian.org>
Sun, 4 Dec 2011 19:20:39 +0000 (15:20 -0400)
committerDavid Bremner <bremner@debian.org>
Mon, 5 Dec 2011 02:00:25 +0000 (22:00 -0400)
We want to make sure g_type_init is called before any GObject
functionality is used.

lib/database.cc

index e4ef14e0c1ee7d7a748e9116de5a20a11e035860..98f101e6e617a04e9b6c26213f7e35a03dd5c0c3 100644 (file)
@@ -26,6 +26,7 @@
 #include <signal.h>
 
 #include <glib.h> /* g_free, GPtrArray, GHashTable */
+#include <glib-object.h> /* g_type_init */
 
 using namespace std;
 
@@ -600,6 +601,9 @@ notmuch_database_open (const char *path,
        goto DONE;
     }
 
+    /* Initialize the GLib type system and threads */
+    g_type_init ();
+
     notmuch = talloc (NULL, notmuch_database_t);
     notmuch->exception_reported = FALSE;
     notmuch->path = talloc_strdup (notmuch, path);