[geary/wip/765516-gtk-widget-conversation-viewer: 164/207] Fix a crit warning when switching folders.



commit 44d2faa401b17baff5c777704c38d16f53303ed4
Author: Michael James Gratton <mike vee net>
Date:   Tue Sep 6 10:23:37 2016 +1000

    Fix a crit warning when switching folders.

 .../conversation-viewer/conversation-listbox.vala  |    7 -----
 .../conversation-viewer/conversation-viewer.vala   |   24 +++++++++++++------
 2 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-listbox.vala 
b/src/client/conversation-viewer/conversation-listbox.vala
index 14b80d0..02f470c 100644
--- a/src/client/conversation-viewer/conversation-listbox.vala
+++ b/src/client/conversation-viewer/conversation-listbox.vala
@@ -256,13 +256,6 @@ public class ConversationListBox : Gtk.ListBox {
     }
 
     /**
-     * Cancel all loading activity for the conversation.
-     */
-    public void cancel_load() {
-        this.cancellable.cancel();
-    }
-
-    /**
      * Returns the email view to be replied to, if any.
      *
      * If an email view has a visible body and selected text, that
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index 38950cc..a1d99b7 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -212,14 +212,6 @@ public class ConversationViewer : Gtk.Stack {
         }
     }
 
-    /**
-     * Sets the currently visible page of the stack.
-     */
-    private new void set_visible_child(Gtk.Widget widget) {
-        debug("Showing: %s\n", widget.get_name());
-        base.set_visible_child(widget);
-    }
-
     // Add a new conversation list to the UI
     private void add_new_list(ConversationListBox list) {
         this.current_list = list;
@@ -248,6 +240,22 @@ public class ConversationViewer : Gtk.Stack {
         }
     }
 
+    /**
+     * Sets the currently visible page of the stack.
+     */
+    private new void set_visible_child(Gtk.Widget widget) {
+        debug("Showing: %s\n", widget.get_name());
+        if (widget != this.conversation_page &&
+            get_visible_child() == this.conversation_page) {
+            // By removing the current list, any load it is currently
+            // performing is also cancelled, which is important to
+            // avoid a possible crit warning when switching folders,
+            // etc.
+            remove_current_list();
+        }
+        base.set_visible_child(widget);
+    }
+
     [GtkCallback]
     private void on_find_search_started(Object obj, ParamSpec param) {
         if (this.conversation_find_bar.get_search_mode()) {


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