From 0545e6b8c0d5864b3473f0636f977b954934b496 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 31 Mar 2017 01:02:49 +0300 Subject: [PATCH] imap: Fix assert-crash when hibernation triggers during IDLE syncing Fixes: Panic: file cmd-idle.c: line 182 (idle_hibernate_timeout): assertion failed: (ctx->sync_ctx == NULL) --- src/imap/cmd-idle.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/imap/cmd-idle.c b/src/imap/cmd-idle.c index 8e3ae64319..330222878f 100644 --- a/src/imap/cmd-idle.c +++ b/src/imap/cmd-idle.c @@ -140,6 +140,12 @@ static bool idle_sync_now(struct mailbox *box, struct cmd_idle_context *ctx) { i_assert(ctx->sync_ctx == NULL); + if (ctx->to_hibernate != NULL) { + /* hibernation can't happen while sync is running. + the timeout is added back afterwards. */ + timeout_remove(&ctx->to_hibernate); + } + ctx->sync_pending = FALSE; ctx->sync_ctx = imap_sync_init(ctx->client, box, 0, 0); return cmd_idle_continue(ctx->cmd);