# HG changeset patch # User Timo Sirainen # Date 1296433046 -7200 # Node ID cecc6c28ce0e57f08ae15a52cda9bf0b87f78e1c # Parent 676b6d931624ff70bb688aec2eaa6e10d79ff0bc lib-storage: Threading code uses now separate extra_wanted_headers also. diff -r 676b6d931624 -r cecc6c28ce0e src/lib-storage/index/index-thread.c --- a/src/lib-storage/index/index-thread.c Mon Jan 31 02:13:51 2011 +0200 +++ b/src/lib-storage/index/index-thread.c Mon Jan 31 02:17:26 2011 +0200 @@ -297,10 +297,10 @@ NULL }; struct mail_thread_mailbox *tbox = MAIL_THREAD_CONTEXT(ctx->box); - struct mailbox_header_lookup_ctx *headers_ctx; struct mail_search_args *search_args; struct mail_search_context *search_ctx; struct mail *mail; + struct mail_private *pmail; uint32_t last_uid, seq1, seq2; int ret = 0; @@ -316,8 +316,10 @@ &tbox->msgid_hash); } - headers_ctx = mailbox_header_lookup_init(ctx->box, wanted_headers); - ctx->tmp_mail = mail_alloc(ctx->t, 0, headers_ctx); + ctx->tmp_mail = mail_alloc(ctx->t, 0, NULL); + pmail = (struct mail_private *)ctx->tmp_mail; + pmail->extra_wanted_headers = + mailbox_header_lookup_init(ctx->box, wanted_headers); /* add all missing UIDs */ ctx->strmap_sync = mail_index_strmap_view_sync_init(tbox->strmap_view, @@ -326,7 +328,6 @@ &seq1, &seq2); if (seq1 == 0) { /* nothing is missing */ - mailbox_header_lookup_unref(&headers_ctx); mail_index_strmap_view_sync_commit(&ctx->strmap_sync); return 0; } @@ -335,8 +336,10 @@ mail_search_build_add_seqset(search_args, seq1, seq2); search_ctx = mailbox_search_init(ctx->t, search_args, NULL); - mail = mail_alloc(ctx->t, 0, headers_ctx); - mailbox_header_lookup_unref(&headers_ctx); + mail = mail_alloc(ctx->t, 0, NULL); + pmail = (struct mail_private *)mail; + pmail->extra_wanted_headers = + mailbox_header_lookup_init(ctx->box, wanted_headers); while (mailbox_search_next(search_ctx, mail)) { if (mail_thread_map_add_mail(ctx, mail) < 0) { @@ -344,6 +347,7 @@ break; } } + mailbox_header_lookup_unref(&pmail->extra_wanted_headers); mail_free(&mail); if (mailbox_search_deinit(&search_ctx) < 0) ret = -1; @@ -586,6 +590,9 @@ static void mail_thread_clear(struct mail_thread_context *ctx) { + struct mail_private *pmail = (struct mail_private *)ctx->tmp_mail; + + mailbox_header_lookup_unref(&pmail->extra_wanted_headers); mail_free(&ctx->tmp_mail); (void)mailbox_transaction_commit(&ctx->t); }