]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Keep indexes open while they are in alloc-cache.
authorTimo Sirainen <tss@iki.fi>
Sat, 20 Feb 2010 09:45:52 +0000 (11:45 +0200)
committerTimo Sirainen <tss@iki.fi>
Sat, 20 Feb 2010 09:45:52 +0000 (11:45 +0200)
--HG--
branch : HEAD

src/lib-index/mail-index-alloc-cache.c

index 1f62929267685f231a31fd5efc1f13a77ecd3a31..2d18b1fdb0284de57252646e9483e9cb3d4d5fd2 100644 (file)
@@ -58,6 +58,8 @@ mail_index_alloc_cache_add(struct mail_index *index,
 static void
 mail_index_alloc_cache_list_free(struct mail_index_alloc_cache_list *list)
 {
+       if (list->index->open_count > 0)
+               mail_index_close(list->index);
        mail_index_free(&list->index);
        i_free(list->mailbox_path);
        i_free(list);
@@ -212,5 +214,7 @@ void mail_index_alloc_cache_index_opened(struct mail_index *index)
                        list->index_dir_ino = st.st_ino;
                        list->index_dir_dev = st.st_dev;
                }
+               /* keep it referenced for ourself */
+               index->open_count++;
        }
 }