# HG changeset patch # User Timo Sirainen # Date 1194365338 -7200 # Node ID faa4da358d37c5c82b026cb545836720c1e426d9 # Parent 76cf2e548c6da979015f05275ca9d97d575d1a15 Last change caused assert-crashes. diff -r 76cf2e548c6d -r faa4da358d37 src/lib-index/mail-cache-transaction.c --- 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. */