[geary/wip/765516-gtk-widget-conversation-viewer: 123/142] Fix massive memory leak due to some convo widgets never being freed.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/765516-gtk-widget-conversation-viewer: 123/142] Fix massive memory leak due to some convo widgets never being freed.
- Date: Fri, 2 Sep 2016 04:35:57 +0000 (UTC)
commit 7d7e96fd1388ced2567619b8067991443f1730d1
Author: Michael James Gratton <mike vee net>
Date: Sun Aug 14 13:32:53 2016 +1000
Fix massive memory leak due to some convo widgets never being freed.
.../conversation-viewer/conversation-listbox.vala | 10 +++++++++-
.../conversation-viewer/conversation-viewer.vala | 10 ++++------
2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-listbox.vala
b/src/client/conversation-viewer/conversation-listbox.vala
index 5179283..e5b829f 100644
--- a/src/client/conversation-viewer/conversation-listbox.vala
+++ b/src/client/conversation-viewer/conversation-listbox.vala
@@ -196,11 +196,19 @@ public class ConversationListBox : Gtk.ListBox {
}
~ConversationListBox() {
+ 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);
- get_adjustment().value_changed.disconnect(check_mark_read);
+ 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.destroy();
}
public async void load_conversation()
diff --git a/src/client/conversation-viewer/conversation-viewer.vala
b/src/client/conversation-viewer/conversation-viewer.vala
index fc3f61a..e98e8c9 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -287,16 +287,14 @@ public class ConversationViewer : Gtk.Stack {
// Remove any existing conversation list, cancelling its loading
private void remove_current_list() {
- if (this.current_list != null) {
- this.current_list.cancel_load();
- this.conversation_removed(this.current_list);
- this.current_list.destroy();
- this.current_list = null;
- }
Gtk.Widget? scrolled_child = this.conversation_page.get_child();
if (scrolled_child != null) {
scrolled_child.destroy();
}
+ if (this.current_list != null) {
+ this.conversation_removed(this.current_list);
+ this.current_list = null;
+ }
}
// State reset.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]