# HG changeset patch # User Timo Sirainen # Date 1169045831 -7200 # Node ID 874dede81cc13420f09077fe27a156eedfe17bad # Parent aa4ff7a9c3f7638ea3fbc9fa09b8d01c841bb565 A new "extension introduction" in transaction log could have left some existing views to contain an invalid mapping where it contained the new extension, but with a wrong record_size. diff -r aa4ff7a9c3f7 -r 874dede81cc1 src/lib-index/mail-index-sync-ext.c --- a/src/lib-index/mail-index-sync-ext.c Wed Jan 17 00:39:49 2007 +0200 +++ b/src/lib-index/mail-index-sync-ext.c Wed Jan 17 16:57:11 2007 +0200 @@ -381,6 +381,18 @@ return 1; } + if (map->refcount != 1) { + /* below we'll first add the extension to the mapping, and then + call sync_ext_reorder() which clones the map. that however + leaves this mapping with the new extension, but without + a resized record_size. if the mapping is still used + elsewhere, it will create problems. so here we'll just make + sure that the partially updated mapping will get destroyed + once the resize is complete. */ + map = mail_index_map_clone(map, map->hdr.record_size); + mail_index_sync_replace_map(ctx, map); + } + hdr_buf = map->hdr_copy_buf; if (MAIL_INDEX_HEADER_SIZE_ALIGN(hdr_buf->used) != hdr_buf->used) { /* we need to add padding between base header and extensions */