The code updating the sidebar counts decremented the msgcount, but did
not set it back to the original value. Which means fastclose was not
freeing all the headers.
Update the sidebar only when something is deleted, since I don't
believe it's required otherwise and the code is a bit cleaner that
way.
#ifdef USE_SIDEBAR
if (purge && ctx->deleted)
{
+ int orig_msgcount = ctx->msgcount;
+
for (i = 0; i < ctx->msgcount; i++)
{
if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read)
ctx->flagged--;
}
ctx->msgcount -= ctx->deleted;
+ mutt_sb_set_buffystats (ctx);
+ ctx->msgcount = orig_msgcount;
}
- mutt_sb_set_buffystats (ctx);
#endif
mx_fastclose_mailbox (ctx);