[balsa] mailbox: Lock the mailbox in idle callbacks



commit c0615fd03f8b17f19d417208bed0b3da51bc78d6
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Jan 27 10:20:57 2020 -0500

    mailbox: Lock the mailbox in idle callbacks
    
    * libbalsa/mailbox.c (lbm_msgno_filt_check_idle_cb),
      (lbm_set_threading_idle_cb):

 ChangeLog          | 7 +++++++
 libbalsa/mailbox.c | 4 ++++
 2 files changed, 11 insertions(+)
---
diff --git a/ChangeLog b/ChangeLog
index 199f7177f..9ec080721 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-27  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       mailbox: Lock the mailbox in idle callbacks
+
+       * libbalsa/mailbox.c (lbm_msgno_filt_check_idle_cb),
+       (lbm_set_threading_idle_cb):
+
 2020-01-26  Peter Bloomfield  <pbloomfield bellsouth net>
 
        mailbox: Always use the idle callback to sort after changing the
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 61b9697b5..3482a4090 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -1679,9 +1679,11 @@ typedef struct {
 static gboolean
 lbm_msgno_filt_check_idle_cb(LibBalsaMailboxMsgnoFiltCheckInfo * info)
 {
+    libbalsa_lock_mailbox(info->mailbox);
     if (MAILBOX_OPEN(info->mailbox))
         lbm_msgno_filt_check(info->mailbox, info->seqno, info->search_iter,
                              info->hold_selected);
+    libbalsa_unlock_mailbox(info->mailbox);
 
     g_object_unref(info->mailbox);
     libbalsa_mailbox_search_iter_unref(info->search_iter);
@@ -2326,9 +2328,11 @@ lbm_set_threading_idle_cb(LibBalsaMailbox * mailbox)
 {
     LibBalsaMailboxPrivate *priv = libbalsa_mailbox_get_instance_private(mailbox);
 
+    libbalsa_lock_mailbox(mailbox);
     lbm_check_and_sort(mailbox);
 
     priv->set_threading_idle_id = 0;
+    libbalsa_unlock_mailbox(mailbox);
 
     return G_SOURCE_REMOVE;
 }


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