mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
Actually close the xapian database in notmuch_database_close
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>
This commit is contained in:
parent
3ed8c3d9a6
commit
cfc5f1059a
1 changed files with 11 additions and 0 deletions
|
@ -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->term_gen;
|
||||||
delete notmuch->query_parser;
|
delete notmuch->query_parser;
|
||||||
delete notmuch->xapian_db;
|
delete notmuch->xapian_db;
|
||||||
|
|
Loading…
Reference in a new issue