X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;ds=sidebyside;f=database.cc;h=8d477eca069abb7e3d1619d5881d3b3ad8d44469;hb=854f82fb91ef9560259e4597d475747e948204d5;hp=eab249910f39de927df3fe89eb17a4b43843db97;hpb=8e96a87fff4d34a154d1456e9ad47e7b0c322d54;p=notmuch diff --git a/database.cc b/database.cc index eab24991..8d477eca 100644 --- a/database.cc +++ b/database.cc @@ -166,6 +166,8 @@ notmuch_status_to_string (notmuch_status_t status) return "Erroneous NULL pointer"; case NOTMUCH_STATUS_TAG_TOO_LONG: return "Tag value is too long (exceeds NOTMUCH_TAG_MAX)"; + case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: + return "Unblanced number of calls to notmuch_message_freeze/thaw"; default: case NOTMUCH_STATUS_LAST_STATUS: return "Unknown error status value"; @@ -503,6 +505,8 @@ notmuch_database_open (const char *path) void notmuch_database_close (notmuch_database_t *notmuch) { + notmuch->xapian_db->flush (); + delete notmuch->query_parser; delete notmuch->xapian_db; talloc_free (notmuch); @@ -821,7 +825,8 @@ _notmuch_database_link_message (notmuch_database_t *notmuch, notmuch_status_t notmuch_database_add_message (notmuch_database_t *notmuch, - const char *filename) + const char *filename, + notmuch_message_t **message_ret) { notmuch_message_file_t *message_file; notmuch_message_t *message; @@ -926,8 +931,13 @@ notmuch_database_add_message (notmuch_database_t *notmuch, } DONE: - if (message) - notmuch_message_destroy (message); + if (message) { + if (message_ret) + *message_ret = message; + else + notmuch_message_destroy (message); + } + if (message_file) notmuch_message_file_close (message_file);