From: David Bremner <bremner@debian.org>
Date: Sun, 4 Dec 2011 19:20:39 +0000 (-0400)
Subject: lib: call g_type_init from notmuch_database_open
X-Git-Tag: 0.10.2~7
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=69dc421ab3355930f23ec6aa47e7e936cbfafb97;p=obsolete%2Fnotmuch-old

lib: call g_type_init from notmuch_database_open

We want to make sure g_type_init is called before any GObject
functionality is used.
---

diff --git a/lib/database.cc b/lib/database.cc
index e4ef14e0..98f101e6 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -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);