X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=database.cc;h=0fd0bdadf8103366b4c2f95924926d1f532df0ca;hb=203a717d64864411eb6802c06a5a0ad1cf98e077;hp=ad91a7d72c8c3521c9e6588c1914af331b8ddd01;hpb=ae0bd3f503c8815affa733f48498bb77d023680b;p=notmuch diff --git a/database.cc b/database.cc index ad91a7d7..0fd0bdad 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); @@ -832,6 +836,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch, const char *from, *to, *subject, *old_filename; char *message_id; + if (message_ret) + *message_ret = NULL; + message_file = notmuch_message_file_open (filename); if (message_file == NULL) { ret = NOTMUCH_STATUS_FILE_ERROR; @@ -928,7 +935,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, DONE: if (message) { - if (message_ret) + if (ret == NOTMUCH_STATUS_SUCCESS && message_ret) *message_ret = message; else notmuch_message_destroy (message);