From: Kevin McCarthy Date: Wed, 27 Jun 2018 16:27:05 +0000 (-0700) Subject: Reset all MonitorContext state on context removal. X-Git-Tag: 2019-10-25~668^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff5f1118ce5100f58cbe01ca54159f415f975ce3;p=neomutt Reset all MonitorContext state on context removal. Reset both the descriptor and changed flag when the current context is removed. Don't make this dependent on the context being valid or being found by monitor_resolve(), in case the context was closed due to some type of error condition. --- diff --git a/monitor.c b/monitor.c index f9ab4a994..3de024481 100644 --- a/monitor.c +++ b/monitor.c @@ -426,12 +426,15 @@ int mutt_monitor_remove(struct Mailbox *mailbox) { struct MonitorInfo info, info2; + if (!mailbox) + { + MonitorContextDescriptor = -1; + MonitorContextChanged = 0; + } + if (monitor_resolve(&info, mailbox) != RESOLVERES_OK_EXISTING) return 2; - if (!mailbox && (MonitorContextDescriptor == info.monitor->desc)) - MonitorContextDescriptor = -1; - if (Context) { if (mailbox)