[balsa/56-imap-expunge] Remove a scheduled idle callback at close time



commit 26c1c45f6264c210573040ef202412314c6dde9f
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Mar 8 20:22:09 2021 -0500

    Remove a scheduled idle callback at close time
    
    mailbox-imap: Remove a scheduled idle callback at close time instead of at dispose
    time. Actually, we keep the dispose time code, but document that it should not be
    necessary.
    
    * libbalsa/mailbox_imap.c
      (libbalsa_mailbox_imap_close): remove expunged idle source, if any;
      (libbalsa_mailbox_imap_dispose): comment that it should have been removed at close time.

 ChangeLog               | 10 ++++++++++
 libbalsa/mailbox_imap.c |  6 ++++++
 2 files changed, 16 insertions(+)
---
diff --git a/ChangeLog b/ChangeLog
index 91f30048e..19a6d28c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2021-03-08  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Remove a scheduled idle callback at close time instead of at
+       dispose time.
+
+       * libbalsa/mailbox_imap.c
+         (libbalsa_mailbox_imap_close): remove expunged idle source, if any;
+         (libbalsa_mailbox_imap_dispose): comment that it should have
+           been removed at close time.
+
 2021-03-08  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Handle expunged IMAP messages in an idle callback
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index 10586f999..c8a8eda4c 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -304,6 +304,8 @@ libbalsa_mailbox_imap_dispose(GObject * object)
     }
 
     if (mimap->expunged_idle_id != 0) {
+        /* Should have been removed at close time, but to be on the safe
+         * side: */
         g_source_remove(mimap->expunged_idle_id);
         mimap->expunged_idle_id = 0;
     }
@@ -1207,6 +1209,10 @@ libbalsa_mailbox_imap_close(LibBalsaMailbox * mailbox, gboolean expunge)
     }
     clean_cache(mailbox);
 
+    if (mimap->expunged_idle_id != 0) {
+        g_source_remove(mimap->expunged_idle_id);
+        mimap->expunged_idle_id = 0;
+    }
 
     free_messages_info(mimap);
     libbalsa_mailbox_imap_release_handle(mimap);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]