[balsa/gtk3] Replace Gdk lock with our own lock



commit 632966b0cd90d77ab6fcbf3a2a8d8e32a41acb6f
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Apr 10 07:47:14 2013 -0400

    Replace Gdk lock with our own lock
    
        * src/balsa-mblist.c (update_mailbox_idle),
        (bmbl_mailbox_changed_cb): replace Gdk lock with our own lock.

 ChangeLog          |    5 +++++
 src/balsa-mblist.c |   11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9df30fe..844e183 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-10  Peter Bloomfield
+
+       * src/balsa-mblist.c (update_mailbox_idle),
+       (bmbl_mailbox_changed_cb): replace Gdk lock with our own lock.
+
 2013-04-09  Peter Bloomfield
 
        * libbalsa/imap/imap_tst.c (main): g_type_init is deprecated.
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index 2d141d6..d3860cd 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -973,10 +973,13 @@ struct update_mbox_data {
 };
 static void bmbl_update_mailbox(GtkTreeStore * store,
                                 LibBalsaMailbox * mailbox);
+
+G_LOCK_DEFINE_STATIC(mblist_update);
+
 static gboolean
 update_mailbox_idle(struct update_mbox_data *umd)
 {
-    gdk_threads_enter();
+    G_LOCK(mblist_update);
 
     if (umd->mailbox) {
         g_object_remove_weak_pointer(G_OBJECT(umd->mailbox),
@@ -1011,7 +1014,7 @@ update_mailbox_idle(struct update_mbox_data *umd)
     }
     g_free(umd);
 
-    gdk_threads_leave();
+    G_UNLOCK(mblist_update);
 
     return FALSE;
 }
@@ -1023,6 +1026,8 @@ bmbl_mailbox_changed_cb(LibBalsaMailbox * mailbox, gpointer data)
 
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
 
+    G_LOCK(mblist_update);
+
     umd = g_object_get_data(G_OBJECT(mailbox), "mblist-update");
 
     if (!umd) {
@@ -1036,6 +1041,8 @@ bmbl_mailbox_changed_cb(LibBalsaMailbox * mailbox, gpointer data)
 
     umd->notify = (mailbox->state == LB_MAILBOX_STATE_OPEN
                    || mailbox->state == LB_MAILBOX_STATE_CLOSED);
+
+    G_UNLOCK(mblist_update);
 }
 
 /* public methods */


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