[geary] Fix segfault closing client after starting it without network access.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Fix segfault closing client after starting it without network access.
- Date: Thu, 9 Feb 2017 10:56:23 +0000 (UTC)
commit c1fb400e2426ec14ddfcdcf5160bc71290305e57
Author: Michael James Gratton <mike vee net>
Date: Thu Feb 9 10:56:45 2017 +1100
Fix segfault closing client after starting it without network access.
* src/client/conversation-list/conversation-list-view.vala
(ConversationListView): Convert to using IdleManager for handling
selection updating, reset it when widget is destroyed.
.../conversation-list/conversation-list-view.vala | 22 ++++++++++----------
1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-view.vala
b/src/client/conversation-list/conversation-list-view.vala
index fdacaa1..8be3c1e 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -18,7 +18,7 @@ public class ConversationListView : Gtk.TreeView {
private Geary.Scheduler.Scheduled? scheduled_update_visible_conversations = null;
private Gtk.Menu? context_menu = null;
private Gee.Set<Geary.App.Conversation> selected = new Gee.HashSet<Geary.App.Conversation>();
- private uint selection_changed_id = 0;
+ private Geary.IdleManager selection_update;
private bool suppress_selection = false;
public signal void conversations_selected(Gee.Set<Geary.App.Conversation> selected);
@@ -35,6 +35,7 @@ public class ConversationListView : Gtk.TreeView {
public signal void visible_conversations_changed(Gee.Set<Geary.App.Conversation> visible);
+
public ConversationListView() {
set_show_expanders(false);
set_headers_visible(false);
@@ -69,6 +70,14 @@ public class ConversationListView : Gtk.TreeView {
unowned Gtk.BindingSet? binding_set = Gtk.BindingSet.find("GtkTreeView");
assert(binding_set != null);
Gtk.BindingEntry.remove(binding_set, Gdk.Key.N, Gdk.ModifierType.CONTROL_MASK);
+
+ this.selection_update = new Geary.IdleManager(do_selection_changed);
+ this.selection_update.priority = Geary.IdleManager.Priority.LOW;
+ }
+
+ public override void destroy() {
+ this.selection_update.reset();
+ base.destroy();
}
public new ConversationListStore? get_model() {
@@ -365,9 +374,6 @@ public class ConversationListView : Gtk.TreeView {
}
private void on_selection_changed() {
- if (this.selection_changed_id != 0)
- Source.remove(this.selection_changed_id);
-
// Schedule processing selection changes at low idle for
// two reasons: (a) if a lot of changes come in
// back-to-back, this allows for all that activity to
@@ -377,13 +383,7 @@ public class ConversationListView : Gtk.TreeView {
// order by this class and the ConversationListView and
// not result in a lot of screen flashing and (again)
// unnecessary I/O as both classes update selection state.
- this.selection_changed_id = Idle.add(() => {
- // De-schedule the callback
- this.selection_changed_id = 0;
-
- do_selection_changed();
- return Source.REMOVE;
- }, Priority.LOW);
+ this.selection_update.schedule();
}
// Gtk.TreeSelection can fire its "changed" signal even when
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]