From: Timo Sirainen Date: Mon, 21 Jul 2008 00:21:25 +0000 (+0300) Subject: If UIDVALIDITY changes and view hasn't noticed it yet, don't assert-crash X-Git-Tag: 1.2.alpha1~116 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=273f714d5640dca9ad13fc17de3bcb2cf5b1abff;p=thirdparty%2Fdovecot%2Fcore.git If UIDVALIDITY changes and view hasn't noticed it yet, don't assert-crash when saving messages. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-index-transaction.c b/src/lib-index/mail-index-transaction.c index e0f117a4ea..90268a0985 100644 --- a/src/lib-index/mail-index-transaction.c +++ b/src/lib-index/mail-index-transaction.c @@ -536,12 +536,15 @@ void mail_index_transaction_sort_appends(struct mail_index_transaction *t) uint32_t mail_index_transaction_get_next_uid(struct mail_index_transaction *t) { - const struct mail_index_header *hdr; + const struct mail_index_header *head_hdr, *hdr; const struct mail_index_record *recs; unsigned int count, offset; uint32_t next_uid; - next_uid = t->reset ? 1 : t->view->map->hdr.next_uid; + head_hdr = &t->view->index->map->hdr; + hdr = &t->view->map->hdr; + next_uid = t->reset || head_hdr->uid_validity != hdr->uid_validity ? + 1 : hdr->next_uid; if (array_is_created(&t->appends)) { /* get next_uid from appends if they have UIDs */ mail_index_transaction_sort_appends(t);