]> granicus.if.org Git - neomutt/commitdiff
Reset all MonitorContext state on context removal.
authorKevin McCarthy <kevin@8t8.us>
Wed, 27 Jun 2018 16:27:05 +0000 (09:27 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 3 Sep 2018 01:04:32 +0000 (02:04 +0100)
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

index f9ab4a994b2f88e9afc24cc6b64580ff3aecca1c..3de02448147b955d6a23a79917dad98c48c297d3 100644 (file)
--- 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)