[balsa/gtk3] Check mail in subthread so signal handler returns



commit 763e742ace30ffc03f9eb4fa34ab1e075f46c4dd
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Fri Oct 21 22:37:13 2011 -0400

    Check mail in subthread so signal handler returns
    
    	* src/main-window.c: when network is connected, check mail in
    	the subthread, so that the signal handler can return.

 ChangeLog         |    5 +++++
 src/main-window.c |   24 ++++++++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 41bd554..f8e1ce6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-21  Peter Bloomfield
+
+	* src/main-window.c: when network is connected, check mail in
+	the subthread, so that the signal handler can return.
+
 2011-10-14  Peter Bloomfield
 
 	gtk_assistant_set_page_header_image and
diff --git a/src/main-window.c b/src/main-window.c
index b287a1f..52fc9ab 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -3569,10 +3569,24 @@ mw_mbox_change_connection_status(GtkTreeModel * model, GtkTreePath * path,
 static void*
 bw_change_connection_status_thread(void *arg)
 {
+    gboolean is_connected = GPOINTER_TO_INT(arg);
+
     gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
 			   (GtkTreeModelForeachFunc)
                            mw_mbox_change_connection_status,
 			   arg);
+
+    /* GLib timeouts are now triggered by g_get_monotonic_time(),
+     * which doesn't increment while we're suspended, so we must
+     * check for ourselves whether a scheduled mail check was
+     * missed. */
+    if (is_connected &&
+        difftime(time(NULL), balsa_app.main_window->last_check_time) >
+        balsa_app.check_mail_timer * 60) {
+        /* Check the mail now, and reset the timer */
+        check_new_messages_cb(NULL, balsa_app.main_window);
+    }
+
     return NULL;
 }
 #endif /* BALSA_USE_THREADS */
@@ -3641,16 +3655,6 @@ bw_nm_client_state_changed_cb(GObject * gobject, GParamSpec * pspec,
                                mw_mbox_change_connection_status,
                                GINT_TO_POINTER(is_connected));
 #endif /* BALSA_USE_THREADS */
-        /* GLib timeouts are now triggered by g_get_monotonic_time(),
-         * which doesn't increment while we're suspended, so we must
-         * check for ourselves whether a scheduled mail check was
-         * missed. */
-        if (is_connected &&
-            difftime(time(NULL), window->last_check_time) >
-            balsa_app.check_mail_timer * 60) {
-            /* Check the mail now, and reset the timer */
-            check_new_messages_cb(NULL, balsa_app.main_window);
-        }
     }
 }
 #endif /* LIBNM_GLIB */



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