[balsa/gtk3] Lock mutex before signalling cond



commit 4cf49d0cbec5e2e0e2300af7cdfc70f3919c5326
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Jun 13 15:41:59 2012 -0400

    Lock mutex before signalling cond
    
    	* libbalsa/mailbox.c (lbm_msgno_inserted_idle_cb): lock mutex
    	before signalling cond.

 ChangeLog          |    5 +++++
 libbalsa/mailbox.c |    8 ++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 45f985f..7070145 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-06-13  Peter Bloomfield
 
+	* libbalsa/mailbox.c (lbm_msgno_inserted_idle_cb): lock mutex
+	before signalling cond.
+
+2012-06-13  Peter Bloomfield
+
 	* src/balsa-app.c (find_url_idle_cb): lock mutex before
 	signalling cond.
 
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 7ac0aec..2d936bd 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -1404,14 +1404,22 @@ typedef struct {
 static gboolean
 lbm_msgno_inserted_idle_cb(LbmMsgnoInsertedInfo * info)
 {
+#if GLIB_CHECK_VERSION(2, 32, 0)
+    g_mutex_lock(&info->mutex);
+#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
+    g_mutex_lock(info->mutex);
+#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
+
     lbm_msgno_inserted(info->mailbox, info->seqno, info->parent,
                        info->sibling);
     info->wait = FALSE;
 
 #if GLIB_CHECK_VERSION(2, 32, 0)
     g_cond_signal(&info->cond);
+    g_mutex_unlock(&info->mutex);
 #else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
     g_cond_signal(info->cond);
+    g_mutex_unlock(info->mutex);
 #endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 
     return FALSE;



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