Calling pool_unref() set the mail_private->pool=NULL, which crashed in
index_mail_free(). Fixed this by removing the unnecessary ref/unref
entirely. We're already waiting in imapc_mail_close() for all the
existing FETCHes to finish, so the callback will always have only
valid mails with valid pools.
imapc_mail_set_failure(mail, reply);
if (--mail->fetch_count == 0)
mail->fetching_fields = 0;
- pool_unref(&mail->imail.mail.pool);
mbox = (struct imapc_mailbox *)mail->imail.mail.mail.box;
}
i_assert(mbox != NULL);
str_truncate(str, str_len(str)-1);
str_append_c(str, ')');
- pool_ref(mail->imail.mail.pool);
mail->fetching_fields |= fields;
mail->fetch_count++;
mail->fetch_sent = FALSE;
buffer_free(&mail->body);
mail->header_fetched = FALSE;
mail->body_fetched = FALSE;
+
+ i_assert(mail->fetch_count == 0);
}
static int imapc_mail_get_hdr_hash(struct index_mail *imail)