X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fdatabase.cc;h=8f8df1a1434ed604ca2fe1a7bdf5f87b7084a28d;hb=cfc5f1059aa16753cba610c41601cacc97260e08;hp=5efa85eb162ab47085f4105ebd5b0a0a86f84ddd;hpb=3ed8c3d9a6915f7598c3d2aae3c1d8ea9a9ce140;p=notmuch 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;