X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fdatabase.cc;h=8f8df1a1434ed604ca2fe1a7bdf5f87b7084a28d;hp=5efa85eb162ab47085f4105ebd5b0a0a86f84ddd;hb=cfc5f1059aa16753cba610c41601cacc97260e08;hpb=e2e95caa51f8c1ea57b4fc7d3926fda1fb1aed10 diff --git a/lib/database.cc b/lib/database.cc index 5efa85eb..8f8df1a1 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;