From 68d0e90f11f689c2896a024d22b34a84224659e7 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Wed, 27 Jun 2018 09:27:05 -0700 Subject: [PATCH] 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. --- monitor.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index c42fedca..79b4341b 100644 --- a/monitor.c +++ b/monitor.c @@ -414,12 +414,15 @@ int mutt_monitor_remove (BUFFY *buffy) { MONITORINFO info, info2; + if (!buffy) + { + MonitorContextDescriptor = -1; + MonitorContextChanged = 0; + } + if (monitor_resolve (&info, buffy) != RESOLVERES_OK_EXISTING) return 2; - if (!buffy && (MonitorContextDescriptor == info.monitor->descr)) - MonitorContextDescriptor = -1; - if (Context) { if (buffy) -- 2.50.1