]> granicus.if.org Git - mutt/commitdiff
Fix MonitorContextDescriptor update on removal.
authorKevin McCarthy <kevin@8t8.us>
Wed, 27 Jun 2018 02:48:25 +0000 (19:48 -0700)
committerKevin McCarthy <kevin@8t8.us>
Wed, 27 Jun 2018 02:48:25 +0000 (19:48 -0700)
Reset the context descriptor before checking for the monitor being
shared by another mailbox.  Technically, it would be set properly
during the next add, but it shouldn't be left incorrect.

monitor.c

index da9afc6985d52ef4a96d2a37b202fc7445f22fb6..c42fedca111aea5ee7edcba8ea489484b4730c92 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -417,6 +417,9 @@ int mutt_monitor_remove (BUFFY *buffy)
   if (monitor_resolve (&info, buffy) != RESOLVERES_OK_EXISTING)
     return 2;
 
+  if (!buffy && (MonitorContextDescriptor == info.monitor->descr))
+    MonitorContextDescriptor = -1;
+
   if (Context)
   {
     if (buffy)
@@ -435,9 +438,6 @@ int mutt_monitor_remove (BUFFY *buffy)
   inotify_rm_watch(info.monitor->descr, INotifyFd);
   dprint (3, (debugfile, "monitor: inotify_rm_watch for '%s' descriptor=%d\n", info.path, info.monitor->descr));
 
-  if (!buffy && (MonitorContextDescriptor == info.monitor->descr))
-    MonitorContextDescriptor = -1;
-
   monitor_delete (info.monitor);
   monitor_check_free ();
   return 0;