X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fdatabase.cc;h=8103bd96ef88c0e30f256753145f17f5583118a2;hp=d11dfaf3dc7245b6b0f7988f5056144e318d8dd4;hb=442d405ad301bd0bc9dc1d385c21f943ba743308;hpb=7da6733e890b913281afd5061cf5a648094a1eb4 diff --git a/lib/database.cc b/lib/database.cc index d11dfaf3..8103bd96 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -28,6 +28,8 @@ #include /* g_free, GPtrArray, GHashTable */ #include /* g_type_init */ +#include /* g_mime_init */ + using namespace std; #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0])) @@ -585,6 +587,7 @@ notmuch_database_open (const char *path, struct stat st; int err; unsigned int i, version; + static int initialized = 0; if (asprintf (¬much_path, "%s/%s", path, ".notmuch") == -1) { notmuch_path = NULL; @@ -608,6 +611,12 @@ notmuch_database_open (const char *path, /* Initialize the GLib type system and threads */ g_type_init (); + /* Initialize gmime */ + if (! initialized) { + g_mime_init (0); + initialized = 1; + } + notmuch = talloc (NULL, notmuch_database_t); notmuch->exception_reported = FALSE; notmuch->path = talloc_strdup (notmuch, path);