[balsa] mailbox: Check whether the mailbox was closed



commit a9bbd483e8b208d4f244ab1d9fe07b4d99d429fe
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu Jan 9 15:06:02 2020 -0500

    mailbox: Check whether the mailbox was closed
    
    Check whether the mailbox was closed during
    set-fraction, while running filters on reception.
    
    * libbalsa/mailbox.c (lbm_run_filters_on_reception_idle_cb):

 ChangeLog          | 7 +++++++
 libbalsa/mailbox.c | 6 +++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/ChangeLog b/ChangeLog
index 64848a2fb..51c1aa86d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-09  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       mailbox: Check whether the mailbox was closed during
+       set-fraction, while running filters on reception.
+
+       * libbalsa/mailbox.c (lbm_run_filters_on_reception_idle_cb):
+
 2020-01-09  Peter Bloomfield  <pbloomfield bellsouth net>
 
        main-window: Really disconnect from a network monitor signal
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index d05775b1e..0fb2594f0 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -917,11 +917,15 @@ lbm_run_filters_on_reception_idle_cb(LibBalsaMailbox * mailbox)
         for (msgno = 1; msgno <= total; msgno++) {
             if (libbalsa_mailbox_message_match(mailbox, msgno, search_iter))
                 g_array_append_val(msgnos, msgno);
-            if (use_progress)
+            if (use_progress) {
                 libbalsa_progress_set_fraction(&progress,
                                                ((gdouble) ++progress_count)
                                                /
                                                ((gdouble) progress_total));
+                /* mailbox could have been closed during set-fraction */
+                if (priv->state != LB_MAILBOX_STATE_OPEN)
+                    break;
+            }
         }
         libbalsa_mailbox_search_iter_unref(search_iter);
 


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