Skip to content

Commit

Permalink
Revert "Protect ConversationListStore data against shared access"
Browse files Browse the repository at this point in the history
This reverts commit 0309cd7.
  • Loading branch information
marbetschar committed Aug 23, 2021
1 parent 0309cd7 commit 5881e19
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions src/ConversationList/ConversationListStore.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ public class Mail.ConversationListStore : VirtualizingListBoxModel {
private unowned RowVisibilityFunc filter_func;

public override uint get_n_items () {
uint data_length = 0;
lock (data) {
data_length = data.get_length ();
}
return data_length;
return data.get_length ();
}

public override GLib.Object? get_item (uint index) {
Expand All @@ -59,9 +55,7 @@ public class Mail.ConversationListStore : VirtualizingListBoxModel {
}

if (iter == null) {
lock (data) {
iter = data.get_iter_at_pos ((int)index);
}
iter = data.get_iter_at_pos ((int)index);
}

last_iter = iter;
Expand All @@ -83,32 +77,26 @@ public class Mail.ConversationListStore : VirtualizingListBoxModel {
}

public void add (ConversationItemModel data) {
lock (this.data) {
if (compare_func != null) {
this.data.insert_sorted (data, compare_func);
} else {
this.data.append (data);
}
if (compare_func != null) {
this.data.insert_sorted (data, compare_func);
} else {
this.data.append (data);
}

last_iter = null;
last_position = uint.MAX;
}

public void remove (ConversationItemModel data) {
lock (this.data) {
var iter = this.data.get_iter_at_pos (get_index_of_unfiltered (data));
iter.remove ();
}
var iter = this.data.get_iter_at_pos (get_index_of_unfiltered (data));
iter.remove ();

last_iter = null;
last_position = uint.MAX;
}

public void remove_all () {
lock (data) {
data.get_begin_iter ().remove_range (data.get_end_iter ());
}
data.get_begin_iter ().remove_range (data.get_end_iter ());
unselect_all ();

last_iter = null;
Expand Down

0 comments on commit 5881e19

Please sign in to comment.