changeset 6699:faa4da358d37 HEAD

Last change caused assert-crashes.
author Timo Sirainen <tss@iki.fi>
date Tue, 06 Nov 2007 18:08:58 +0200
parents 76cf2e548c6d
children 16fc51385cd1
files src/lib-index/mail-cache-transaction.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-cache-transaction.c	Mon Nov 05 21:51:18 2007 +0200
+++ b/src/lib-index/mail-cache-transaction.c	Tue Nov 06 18:08:58 2007 +0200
@@ -732,9 +732,15 @@
 		if (mail_cache_compress(cache, ctx->trans) < 0)
 			return -1;
 
-		/* compression should have added it */
-		i_assert(cache->field_file_map[field_idx] != (uint32_t)-1);
-		return 0;
+		/* if we compressed the cache, the field should be there now.
+		   it's however possible that someone else just compressed it
+		   and we only reopened the cache file. */
+		if (cache->field_file_map[field_idx] != (uint32_t)-1)
+			return 0;
+
+		/* need to add it */
+		if ((ret = mail_cache_transaction_lock(ctx)) <= 0)
+			return -1;
 	}
 
 	/* re-read header to make sure we don't lose any fields. */