From: Timo Sirainen Date: Thu, 15 Oct 2020 17:34:05 +0000 (+0300) Subject: lib-storage: Delay recreating event when closing mail X-Git-Tag: 2.3.13~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=81e2119bf75245a6ba4350d4454b3fcb2b0731eb;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Delay recreating event when closing mail If the mail isn't reused, the event is unnecessary. --- diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index bc5c89bd81..61e6bfb3d8 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -1794,7 +1794,6 @@ void index_mail_close(struct mail *_mail) /* make sure old mail isn't visible in the event anymore even if it's attempted to be used. */ event_unref(&_mail->event); - index_mail_init_event(&mail->mail.mail); /* If uid == 0 but seq != 0, we came here from saving a (non-mbox) message. If that happens, don't bother checking if anything should @@ -2031,6 +2030,8 @@ void index_mail_set_seq(struct mail *_mail, uint32_t seq, bool saving) mail_index_lookup_uid(_mail->transaction->view, seq, &mail->mail.mail.uid); + if (_mail->event == NULL) + index_mail_init_event(_mail); event_add_int(_mail->event, "seq", _mail->seq); event_add_int(_mail->event, "uid", _mail->uid); event_set_append_log_prefix(_mail->event, t_strdup_printf(