Mercurial > dovecot > core-2.2
changeset 20824:7831283d5c08
lib-storage: Fixed assert-crash in mailbox_save_cancel()
Broken by 05150df8f. Fixes:
Panic: file mail-storage.c: line 2137 (mailbox_save_context_reset): assertion failed: (ctx->saving)
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Wed, 05 Oct 2016 16:34:16 +0300 |
parents | 06fd5e4f123e |
children | b8da0c23f391 |
files | src/lib-storage/mail-storage.c |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-storage.c Tue Sep 27 16:15:42 2016 +0300 +++ b/src/lib-storage/mail-storage.c Wed Oct 05 16:34:16 2016 +0300 @@ -2128,13 +2128,16 @@ save->flags = pvt_flags; } -static void mailbox_save_context_reset(struct mail_save_context *ctx) +static void +mailbox_save_context_reset(struct mail_save_context *ctx, bool success) { i_assert(!ctx->unfinished); if (!ctx->copying_or_moving) { - /* we're finishing a save (not copy/move) */ + /* we're finishing a save (not copy/move). Note that we could + have come here also from mailbox_save_cancel(), in which + case ctx->saving may be FALSE. */ i_assert(!ctx->copying_via_save); - i_assert(ctx->saving); + i_assert(ctx->saving || !success); ctx->saving = FALSE; } else { i_assert(ctx->copying_via_save); @@ -2178,7 +2181,7 @@ } if (keywords != NULL) mailbox_keywords_unref(&keywords); - mailbox_save_context_reset(ctx); + mailbox_save_context_reset(ctx, TRUE); return ret; } @@ -2201,7 +2204,7 @@ mail = (struct mail_private *)ctx->dest_mail; mail->v.close(&mail->mail); } - mailbox_save_context_reset(ctx); + mailbox_save_context_reset(ctx, FALSE); } struct mailbox_transaction_context *