[geary/wip/765516-gtk-widget-conversation-viewer: 150/174] Fix possible crit error when conversation load is cancelled during email load.



commit 36136eb70fc06d1f0c0af80bfe61decaf2061b0f
Author: Michael James Gratton <mike vee net>
Date:   Sat Sep 10 15:25:40 2016 +1000

    Fix possible crit error when conversation load is cancelled during email load.

 .../conversation-viewer/conversation-email.vala    |   25 ++++++++++---------
 1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-email.vala 
b/src/client/conversation-viewer/conversation-email.vala
index d7934b3..b3e302c 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -484,19 +484,20 @@ public class ConversationEmail : Gtk.Box {
      * attachment names, types and icons.
      */
     public async void start_loading(Cancellable load_cancelled) {
-        yield primary_message.load_avatar(
-            GearyApplication.instance.controller.avatar_session,
-            load_cancelled
-        );
-        yield primary_message.load_message_body(load_cancelled);
-        foreach (ConversationMessage message in this._attached_messages) {
-            yield message.load_avatar(
-                GearyApplication.instance.controller.avatar_session,
-                load_cancelled
-            );
-            yield message.load_message_body(load_cancelled);
+        message_view_iterator().foreach((view) => {
+                if (!load_cancelled.is_cancelled()) {
+                    primary_message.load_message_body.begin(load_cancelled);
+                }
+                view.load_avatar.begin(
+                    GearyApplication.instance.controller.avatar_session,
+                    load_cancelled
+                );
+                return !load_cancelled.is_cancelled();
+            });
+
+        if (!load_cancelled.is_cancelled()) {
+            yield load_attachments(load_cancelled);
         }
-        yield load_attachments(load_cancelled);
     }
 
     /**


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