From: Timo Sirainen Date: Sat, 20 Feb 2010 07:46:43 +0000 (+0200) Subject: lib-storage: Thread strmap must not be opened before index is opened. X-Git-Tag: 2.0.beta3~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54e5dadb95d8b7ffce6b5a1f6dbba22044663451;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Thread strmap must not be opened before index is opened. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-index-strmap.c b/src/lib-index/mail-index-strmap.c index abcde3a0dc..a435c07a26 100644 --- a/src/lib-index/mail-index-strmap.c +++ b/src/lib-index/mail-index-strmap.c @@ -99,6 +99,8 @@ mail_index_strmap_init(struct mail_index *index, const char *suffix) { struct mail_index_strmap *strmap; + i_assert(index->open_count > 0); + strmap = i_new(struct mail_index_strmap, 1); strmap->index = index; strmap->path = i_strconcat(index->filepath, suffix, NULL); diff --git a/src/lib-storage/index/index-storage.c b/src/lib-storage/index/index-storage.c index b5d1b6a944..c303c3b6e0 100644 --- a/src/lib-storage/index/index-storage.c +++ b/src/lib-storage/index/index-storage.c @@ -243,6 +243,7 @@ int index_storage_mailbox_open(struct mailbox *box, bool move_to_memory) box->opened = TRUE; + index_thread_mailbox_opened(box); if (hook_mailbox_opened != NULL) hook_mailbox_opened(box); @@ -292,8 +293,6 @@ void index_storage_mailbox_alloc(struct mailbox *box, const char *name, mail_index_set_permissions(box->index, box->file_create_mode, box->file_create_gid, box->file_create_gid_origin); - - index_thread_mailbox_allocated(box); } int index_storage_mailbox_enable(struct mailbox *box, diff --git a/src/lib-storage/index/index-thread-private.h b/src/lib-storage/index/index-thread-private.h index 5b33ad36fa..4f44319188 100644 --- a/src/lib-storage/index/index-thread-private.h +++ b/src/lib-storage/index/index-thread-private.h @@ -77,6 +77,6 @@ mail_thread_iterate_init_full(struct mail_thread_cache *cache, enum mail_thread_type thread_type, bool return_seqs); -void index_thread_mailbox_allocated(struct mailbox *box); +void index_thread_mailbox_opened(struct mailbox *box); #endif diff --git a/src/lib-storage/index/index-thread.c b/src/lib-storage/index/index-thread.c index 9df8598696..5f47874ffd 100644 --- a/src/lib-storage/index/index-thread.c +++ b/src/lib-storage/index/index-thread.c @@ -639,7 +639,7 @@ static void mail_thread_mailbox_free(struct mailbox *box) i_free(tbox); } -void index_thread_mailbox_allocated(struct mailbox *box) +void index_thread_mailbox_opened(struct mailbox *box) { struct mail_thread_mailbox *tbox;