From: Justus Winter <4winter@informatik.uni-hamburg.de>
To: notmuch@notmuchmail.org
Subject: [PATCH] Actually close the xapian database in notmuch_database_close
Date: Fri, 2 Mar 2012 15:58:39 +0100 [thread overview]
Message-ID: <1330700319-26531-1-git-send-email-4winter@informatik.uni-hamburg.de> (raw)
In-Reply-To: <20120301181141.GA4797@mit.edu>
Formerly the xapian database object was deleted and closed in its
destructor once the object was garbage collected. Explicitly call
close() so that the database and the associated lock is released
immediately.
The comment is a courtesy of Austin Clements.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
---
lib/database.cc | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/lib/database.cc b/lib/database.cc
index 5efa85e..8f8df1a 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -726,6 +726,17 @@ notmuch_database_close (notmuch_database_t *notmuch)
}
}
+ /* Many Xapian objects (and thus notmuch objects) hold references to
+ * the database, so merely deleting the database may not suffice to
+ * close it. Thus, we explicitly close it here. */
+ if (notmuch->xapian_db != NULL) {
+ try {
+ notmuch->xapian_db->close();
+ } catch (const Xapian::Error &error) {
+ /* do nothing */
+ }
+ }
+
delete notmuch->term_gen;
delete notmuch->query_parser;
delete notmuch->xapian_db;
--
1.7.9.1
next prev parent reply other threads:[~2012-03-02 14:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 9:19 fix notmuch_database_close Justus Winter
2012-02-29 9:19 ` [PATCH] Actually close the xapian database in notmuch_database_close Justus Winter
2012-02-29 15:48 ` Austin Clements
2012-02-29 21:19 ` Olly Betts
2012-02-29 22:17 ` Austin Clements
2012-03-01 6:59 ` Justus Winter
2012-03-01 18:11 ` Austin Clements
2012-03-02 14:58 ` Justus Winter [this message]
2012-03-03 16:18 ` David Bremner
2012-03-01 21:20 ` Olly Betts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330700319-26531-1-git-send-email-4winter@informatik.uni-hamburg.de \
--to=4winter@informatik.uni-hamburg.de \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).