[geary/wip/765516-gtk-widget-conversation-viewer] Fix ConversationListStore instances never being finalised.



commit 24c5bb485b5475d72a071e62e39614e04cd9125a
Author: Michael James Gratton <mike vee net>
Date:   Fri Aug 19 13:30:44 2016 +1000

    Fix ConversationListStore instances never being finalised.
    
    * src/client/conversation-list/conversation-list-store.vala (ListStore):
      Unset sort function in ::destroy() to release the circular ref it
      holds. Remove some signal handler disconnects that weren't a problem.

 .../conversation-viewer/conversation-listbox.vala  |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-listbox.vala 
b/src/client/conversation-viewer/conversation-listbox.vala
index 58bac60..29bf75a 100644
--- a/src/client/conversation-viewer/conversation-listbox.vala
+++ b/src/client/conversation-viewer/conversation-listbox.vala
@@ -186,13 +186,13 @@ public class ConversationListBox : Gtk.ListBox {
 
         set_adjustment(adjustment);
         set_selection_mode(Gtk.SelectionMode.NONE);
+        set_sort_func(on_sort);
 
         this.key_press_event.connect(on_key_press);
         this.realize.connect(() => {
                 adjustment.value_changed.connect(check_mark_read);
             });
         this.row_activated.connect(on_row_activated);
-        this.set_sort_func(on_sort);
         this.size_allocate.connect(() => { check_mark_read(); });
 
         this.conversation.appended.connect(on_conversation_appended);
@@ -202,17 +202,13 @@ public class ConversationListBox : Gtk.ListBox {
 
     public override void destroy() {
         this.cancellable.cancel();
-        this.conversation.email_flags_changed.disconnect(on_update_flags);
-        this.conversation.trimmed.disconnect(on_conversation_trimmed);
-        this.conversation.appended.disconnect(on_conversation_appended);
-        Gtk.Adjustment adjustment = get_adjustment();
-        if (adjustment != null) {
-            adjustment.value_changed.disconnect(check_mark_read);
-        }
-        this.body_selected_view = null;
-        this.last_email_row = null;
-        this.id_to_row.clear();
+        // Base class will clear the list, so do this before unsetting
+        // the sort function to avoid re-sorting then clearing.
         base.destroy();
+
+        // Release circular refs
+        set_sort_func(null);
+        this.id_to_row.clear();
     }
 
     public async void load_conversation()


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