]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
If UIDVALIDITY changes and view hasn't noticed it yet, don't assert-crash
authorTimo Sirainen <tss@iki.fi>
Mon, 21 Jul 2008 00:21:25 +0000 (03:21 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 21 Jul 2008 00:21:25 +0000 (03:21 +0300)
when saving messages.

--HG--
branch : HEAD

src/lib-index/mail-index-transaction.c

index e0f117a4eaf1e87eaebfcdfd1090bd27091035c3..90268a098508dee185b408dd21ea0f2e9b48d6ce 100644 (file)
@@ -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);