[PATCH] lib: call g_type_init from notmuch_database_open
authorDavid Bremner <david@tethera.net>
Sun, 4 Dec 2011 19:35:14 +0000 (15:35 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:34 +0000 (09:40 -0800)
80/c229a1d605b8574286fc2ebfb43db0376a0d43 [new file with mode: 0644]

diff --git a/80/c229a1d605b8574286fc2ebfb43db0376a0d43 b/80/c229a1d605b8574286fc2ebfb43db0376a0d43
new file mode 100644 (file)
index 0000000..424104b
--- /dev/null
@@ -0,0 +1,88 @@
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 25EB8429E25\r
+       for <notmuch@notmuchmail.org>; Sun,  4 Dec 2011 11:35:22 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id ajvcClmxK1JT for <notmuch@notmuchmail.org>;\r
+       Sun,  4 Dec 2011 11:35:21 -0800 (PST)\r
+Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 7B2E9429E21\r
+       for <notmuch@notmuchmail.org>; Sun,  4 Dec 2011 11:35:21 -0800 (PST)\r
+Received: from zancas.localnet\r
+       (fctnnbsc36w-156034079193.pppoe-dynamic.High-Speed.nb.bellaliant.net\r
+       [156.34.79.193]) (authenticated bits=0)\r
+       by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id pB4JZHrr025303\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);\r
+       Sun, 4 Dec 2011 15:35:17 -0400\r
+Received: from bremner by zancas.localnet with local (Exim 4.77)\r
+       (envelope-from <bremner@tethera.net>)\r
+       id 1RXHqG-0002Hz-OC; Sun, 04 Dec 2011 15:35:16 -0400\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] lib: call g_type_init from notmuch_database_open\r
+Date: Sun,  4 Dec 2011 15:35:14 -0400\r
+Message-Id: <1323027314-8764-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <20111204182948.GU16194@mit.edu>\r
+References: <20111204182948.GU16194@mit.edu>\r
+Cc: David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 04 Dec 2011 19:35:22 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+We want to make sure g_type_init is called before any GObject\r
+functionality is used.\r
+---\r
+This seems to fix the segfault for me. Any other comments/experiences?\r
+\r
+ lib/database.cc |    4 ++++\r
+ 1 files changed, 4 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index e4ef14e..98f101e 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -26,6 +26,7 @@\r
+ #include <signal.h>\r
\r
+ #include <glib.h> /* g_free, GPtrArray, GHashTable */\r
++#include <glib-object.h> /* g_type_init */\r
\r
+ using namespace std;\r
\r
+@@ -600,6 +601,9 @@ notmuch_database_open (const char *path,\r
+       goto DONE;\r
+     }\r
\r
++    /* Initialize the GLib type system and threads */\r
++    g_type_init ();\r
++\r
+     notmuch = talloc (NULL, notmuch_database_t);\r
+     notmuch->exception_reported = FALSE;\r
+     notmuch->path = talloc_strdup (notmuch, path);\r
+-- \r
+1.7.7.3\r
+\r