2007-06-26 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Tue, 26 Jun 2007 12:48:36 +0000 (12:48 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Tue, 26 Jun 2007 12:48:36 +0000 (12:48 +0000)
* src/maemo/modest-maemo-global-settings-dialog.c:
(idle_select_default_focus):
* src/modest-mail-operation.c: (idle_notify_progress),
(idle_notify_progress_once), (idle_notify_update_account_queue),
(set_last_updated_idle), (update_account_thread),
(notify_get_msgs_full), (get_msgs_full_destroyer),
(get_msgs_full_thread):
* src/widgets/modest-attachment-view.c: (get_size_idle_func):
* src/widgets/modest-header-view.c:
(idle_notify_headers_count_changed_destroy),
(idle_notify_headers_count_changed):
Use gdk_threads_enter() and gdk_threads_enter_leave() in
all idle handlers, because some other thread could be blocking
the GDK lock, so that it can do GUI stuff.

pmo-trunk-r2428

ChangeLog2
src/dbus_api/modest-dbus-callbacks.c
src/maemo/modest-maemo-global-settings-dialog.c
src/modest-mail-operation.c
src/widgets/modest-attachment-view.c
src/widgets/modest-header-view.c

index e024e2f..efe1a0c 100644 (file)
@@ -1,5 +1,22 @@
 2007-06-26  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/maemo/modest-maemo-global-settings-dialog.c:
+       (idle_select_default_focus):
+       * src/modest-mail-operation.c: (idle_notify_progress),
+       (idle_notify_progress_once), (idle_notify_update_account_queue),
+       (set_last_updated_idle), (update_account_thread),
+       (notify_get_msgs_full), (get_msgs_full_destroyer),
+       (get_msgs_full_thread):
+       * src/widgets/modest-attachment-view.c: (get_size_idle_func):
+       * src/widgets/modest-header-view.c:
+       (idle_notify_headers_count_changed_destroy),
+       (idle_notify_headers_count_changed):
+       Use gdk_threads_enter() and gdk_threads_enter_leave() in 
+       all idle handlers, because some other thread could be blocking 
+       the GDK lock, so that it can do GUI stuff.
+
+2007-06-26  Murray Cumming  <murrayc@murrayc.com>
+
        * src/dbus_api/modest-dbus-callbacks.c: (on_idle_mail_to),
        (on_idle_compose_mail), (on_compose_mail), (on_idle_open_message),
        (on_idle_send_receive), (on_idle_open_default_inbox):
index 2032a2e..d986723 100644 (file)
@@ -185,7 +185,7 @@ static gchar* uri_parse_mailto (const gchar* mailto, GSList** list_items_and_val
 static gboolean
 on_idle_mail_to(gpointer user_data)
 {
-       gdk_threads_enter();
+       gdk_threads_enter ();
        
        /* This is based on the implemenation of main.c:start_uil(): */
        
@@ -285,7 +285,7 @@ on_idle_mail_to(gpointer user_data)
                
        g_free(uri);
 
-       gdk_threads_leave();
+       gdk_threads_leave ();
        
        return FALSE; /* Do not call this callback again. */
 }
@@ -316,7 +316,7 @@ static gint on_mail_to(GArray * arguments, gpointer data, osso_rpc_t * retval)
 static gboolean
 on_idle_compose_mail(gpointer user_data)
 {
-       gdk_threads_enter();
+       gdk_threads_enter ();
        
        ComposeMailIdleData *idle_data = (ComposeMailIdleData*)user_data;
        gchar **list = NULL;
@@ -394,7 +394,7 @@ on_idle_compose_mail(gpointer user_data)
        
        g_free (account_name);
        
-       gdk_threads_leave();
+       gdk_threads_leave ();
        
        return FALSE; /* Do not call this callback again. */
 }
@@ -508,7 +508,7 @@ out:
 static gboolean
 on_idle_open_message (gpointer user_data)
 {
-       gdk_threads_enter();
+       gdk_threads_enter ();
        
        ModestWindow *msg_view;
        TnyMsg       *msg;
@@ -526,7 +526,7 @@ on_idle_open_message (gpointer user_data)
 
        if (msg == NULL) {
                g_debug ("  %s: message not found.", __FUNCTION__);
-               gdk_threads_leave();
+               gdk_threads_leave ();
                return FALSE;
        }
        g_debug ("  %s: Found message.", __FUNCTION__);
@@ -545,7 +545,7 @@ on_idle_open_message (gpointer user_data)
        g_object_unref (header);
        g_object_unref (account);
        
-       gdk_threads_leave();
+       gdk_threads_leave ();
        
        return FALSE; /* Do not call this callback again. */
 }
@@ -671,7 +671,7 @@ on_delete_message (GArray *arguments, gpointer data, osso_rpc_t *retval)
 static gboolean
 on_idle_send_receive(gpointer user_data)
 {
-       gdk_threads_enter();
+       gdk_threads_enter ();
        ModestWindow *win;
 
        /* Pick the main window if it exists */
@@ -681,7 +681,7 @@ on_idle_send_receive(gpointer user_data)
        /* TODO: check the auto-update parameter in the configuration */
        modest_ui_actions_do_send_receive_all (win);
        
-       gdk_threads_leave();
+       gdk_threads_leave ();
        
        return FALSE; /* Do not call this callback again. */
 }
@@ -703,7 +703,7 @@ static gint on_send_receive(GArray * arguments, gpointer data, osso_rpc_t * retv
 static gboolean
 on_idle_open_default_inbox(gpointer user_data)
 {
-       gdk_threads_enter();
+       gdk_threads_enter ();
        
        ModestWindow *win = 
                modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
@@ -714,7 +714,7 @@ on_idle_open_default_inbox(gpointer user_data)
        modest_folder_view_select_first_inbox_or_local (
                MODEST_FOLDER_VIEW (folder_view));
        
-       gdk_threads_leave();
+       gdk_threads_leave ();
        
        return FALSE; /* Do not call this callback again. */
 }
index a6d1601..5b967bb 100644 (file)
@@ -151,6 +151,8 @@ typedef struct {
 static gboolean
 idle_select_default_focus (gpointer data) 
 {
+       gdk_threads_enter ();
+
        ModestGlobalSettingsDialogPrivate *ppriv;
        ModestMaemoGlobalSettingsDialogPrivate *priv;
        SwitchPageHelper *helper;
@@ -167,6 +169,8 @@ idle_select_default_focus (gpointer data)
 
        g_free (helper);
 
+       gdk_threads_leave ();
+
        return FALSE;
 }
 
index 27cea46..1e3cbe0 100644 (file)
@@ -794,6 +794,8 @@ recurse_folders (TnyFolderStore *store, TnyFolderStoreQuery *query, TnyList *all
 static gboolean
 idle_notify_progress (gpointer data)
 {
+       gdk_threads_enter ();
+
        ModestMailOperation *mail_op = MODEST_MAIL_OPERATION (data);
        ModestMailOperationState *state;
 
@@ -801,6 +803,8 @@ idle_notify_progress (gpointer data)
        g_signal_emit (G_OBJECT (mail_op), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
        g_slice_free (ModestMailOperationState, state);
        
+       gdk_threads_leave ();
+
        return TRUE;
 }
 
@@ -812,6 +816,8 @@ idle_notify_progress (gpointer data)
 static gboolean
 idle_notify_progress_once (gpointer data)
 {
+       gdk_threads_enter ();
+
        ModestPair *pair;
 
        pair = (ModestPair *) data;
@@ -822,6 +828,8 @@ idle_notify_progress_once (gpointer data)
        g_slice_free (ModestMailOperationState, (ModestMailOperationState*)pair->second);
        g_object_unref (pair->first);
 
+       gdk_threads_leave ();
+
        return FALSE;
 }
 
@@ -830,8 +838,10 @@ idle_notify_progress_once (gpointer data)
  * loop. We call it inside an idle call to achieve that
  */
 static gboolean
-notify_update_account_queue (gpointer data)
+idle_notify_update_account_queue (gpointer data)
 {
+       gdk_threads_enter ();
+
        ModestMailOperation *mail_op = MODEST_MAIL_OPERATION (data);
        ModestMailOperationPrivate *priv = NULL;
 
@@ -840,6 +850,8 @@ notify_update_account_queue (gpointer data)
        modest_mail_operation_notify_end (mail_op);
        g_object_unref (mail_op);
 
+       gdk_threads_leave ();
+
        return FALSE;
 }
 
@@ -867,6 +879,8 @@ compare_headers_by_date (gconstpointer a,
 static gboolean 
 set_last_updated_idle (gpointer data)
 {
+       gdk_threads_enter ();
+
        /* It does not matter if the time is not exactly the same than
           the time when this idle was called, it's just an
           approximation and it won't be very different */
@@ -876,6 +890,8 @@ set_last_updated_idle (gpointer data)
                                    time(NULL), 
                                    TRUE);
 
+       gdk_threads_leave ();
+
        return FALSE;
 }
 
@@ -1089,7 +1105,7 @@ update_account_thread (gpointer thr_user_data)
        /* Notify about operation end. Note that the info could be
           freed before this idle happens, but the mail operation will
           be still alive */
-       g_idle_add (notify_update_account_queue, g_object_ref (info->mail_op));
+       g_idle_add (idle_notify_update_account_queue, g_object_ref (info->mail_op));
 
        if (info->callback) {
                /* This thread is not in the main lock */
@@ -1640,6 +1656,8 @@ typedef struct {
 static gboolean
 notify_get_msgs_full (gpointer data)
 {
+       gdk_threads_enter ();
+
        NotifyGetMsgsInfo *info;
 
        info = (NotifyGetMsgsInfo *) data;      
@@ -1652,6 +1670,8 @@ notify_get_msgs_full (gpointer data)
 
        g_slice_free (NotifyGetMsgsInfo, info);
 
+       gdk_threads_leave ();
+
        return FALSE;
 }
 
@@ -1662,6 +1682,8 @@ notify_get_msgs_full (gpointer data)
 static gboolean
 get_msgs_full_destroyer (gpointer data)
 {
+       gdk_threads_enter ();
+
        GetFullMsgsInfo *info;
 
        info = (GetFullMsgsInfo *) data;
@@ -1673,6 +1695,8 @@ get_msgs_full_destroyer (gpointer data)
        g_object_unref (info->headers);
        g_slice_free (GetFullMsgsInfo, info);
 
+       gdk_threads_leave ();
+
        return FALSE;
 }
 
@@ -1744,7 +1768,7 @@ get_msgs_full_thread (gpointer thr_user_data)
                priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS;
 
        /* Notify about operation end */
-       g_idle_add (notify_update_account_queue, g_object_ref (info->mail_op));
+       g_idle_add (idle_notify_update_account_queue, g_object_ref (info->mail_op));
 
        /* Free thread resources. Will be called after all previous idles */
        g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 1, get_msgs_full_destroyer, info, NULL);
index da3456a..db1280d 100644 (file)
@@ -129,6 +129,8 @@ modest_attachment_view_set_part (TnyMimePartView *self, TnyMimePart *mime_part)
 static gboolean
 get_size_idle_func (gpointer data)
 {
+       gdk_threads_enter ();
+
        ModestAttachmentView *self = (ModestAttachmentView *) data;
        ModestAttachmentViewPriv *priv = MODEST_ATTACHMENT_VIEW_GET_PRIVATE (self);
        gssize readed_size;
@@ -158,8 +160,9 @@ get_size_idle_func (gpointer data)
                priv->get_size_idle_id = 0;
        }
 
+       gdk_threads_leave ();
+
        return (priv->get_size_stream != NULL);
-       
 }
 
 static void
index 5bbaa0f..b11d303 100644 (file)
@@ -1394,6 +1394,8 @@ on_focus_in (GtkWidget     *self,
 static void
 idle_notify_headers_count_changed_destroy (gpointer data)
 {
+       gdk_threads_enter ();
+
        HeadersCountChangedHelper *helper = NULL;
 
        g_return_if_fail (data != NULL);
@@ -1401,11 +1403,15 @@ idle_notify_headers_count_changed_destroy (gpointer data)
 
        g_object_unref (helper->change);
        g_slice_free (HeadersCountChangedHelper, helper);
+
+       gdk_threads_leave ();
 }
 
 static gboolean
 idle_notify_headers_count_changed (gpointer data)
 {
+       gdk_threads_enter ();
+
        TnyFolder *folder = NULL;
        ModestHeaderViewPrivate *priv = NULL;
        HeadersCountChangedHelper *helper = NULL;
@@ -1429,6 +1435,8 @@ idle_notify_headers_count_changed (gpointer data)
            
        g_mutex_unlock (priv->observers_lock);
 
+       gdk_threads_leave ();
+
        return FALSE;
 }