changeset 2542:c3608081d0e4 HEAD

When updating index mappings, don't let it affect existing views mappings. Fixes some crashes.
author Timo Sirainen <tss@iki.fi>
date Fri, 03 Sep 2004 22:26:57 +0300
parents 75e8fc49a102
children 2257709d7514
files src/lib-index/mail-index.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index.c	Fri Sep 03 21:33:26 2004 +0300
+++ b/src/lib-index/mail-index.c	Fri Sep 03 22:26:57 2004 +0300
@@ -344,6 +344,13 @@
 	size_t used_size;
 	int ret;
 
+	if (index->map != NULL && index->map->refcount > 1) {
+		/* this map is already used by some views and they may have
+		   pointers into it. leave them and create a new mapping. */
+		index->map->refcount--;
+		index->map = NULL;
+	}
+
 	map = index->map;
 	if (map == NULL) {
 		map = i_new(struct mail_index_map, 1);