dovecot-1.2: If UIDVALIDITY changes and view hasn't noticed it y...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jul 21 03:21:41 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/f0ca5110b99d
changeset: 8045:f0ca5110b99d
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jul 21 03:21:25 2008 +0300
description:
If UIDVALIDITY changes and view hasn't noticed it yet, don't assert-crash
when saving messages.

diffstat:

1 file changed, 5 insertions(+), 2 deletions(-)
src/lib-index/mail-index-transaction.c |    7 +++++--

diffs (21 lines):

diff -r 56c0494d8c49 -r f0ca5110b99d src/lib-index/mail-index-transaction.c
--- a/src/lib-index/mail-index-transaction.c	Mon Jul 21 03:05:22 2008 +0300
+++ b/src/lib-index/mail-index-transaction.c	Mon Jul 21 03:21:25 2008 +0300
@@ -536,12 +536,15 @@ void mail_index_transaction_sort_appends
 
 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);


More information about the dovecot-cvs mailing list