Crash inside of Gee.HashMap: Fixes #5072
The crash inside of HashMap appears to be due to a recent change I made in Geary.Converstions to optimize loading large folders. This reverts Geary back to returning copies of its conversation pools.
This commit is contained in:
parent
8676202f54
commit
754a08ccb9
8 changed files with 35 additions and 20 deletions
|
|
@ -434,7 +434,7 @@ public class GearyController {
|
|||
main_window.message_list_store.update_conversation(conversation);
|
||||
}
|
||||
if (is_viewed_conversation(conversation))
|
||||
do_show_message.begin(conversation.get_email(Geary.Conversation.Ordering.ANY), cancellable_message,
|
||||
do_show_message.begin(conversation.get_email(Geary.Conversation.Ordering.NONE), cancellable_message,
|
||||
on_show_message_completed);
|
||||
}
|
||||
|
||||
|
|
@ -838,7 +838,7 @@ public class GearyController {
|
|||
// Collect all the emails into one pool and then delete.
|
||||
Gee.Set<Geary.Email> all_emails = new Gee.TreeSet<Geary.Email>();
|
||||
foreach (Geary.Conversation conversation in selected_conversations)
|
||||
all_emails.add_all(conversation.get_email(Geary.Conversation.Ordering.ANY));
|
||||
all_emails.add_all(conversation.get_email(Geary.Conversation.Ordering.NONE));
|
||||
|
||||
delete_messages.begin(all_emails, cancellable_folder, on_delete_messages_completed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public class MessageListStore : Gtk.TreeStore {
|
|||
|
||||
// Returns the email to use for a preview in a conversation.
|
||||
public static Geary.Email? email_for_preview(Geary.Conversation conversation) {
|
||||
Gee.SortedSet<Geary.Email> pool = conversation.get_email(Geary.Conversation.Ordering.DATE_ASCENDING);
|
||||
Gee.List<Geary.Email> pool = conversation.get_email(Geary.Conversation.Ordering.DATE_ASCENDING);
|
||||
if (pool.size == 0)
|
||||
return null;
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ public class MessageListStore : Gtk.TreeStore {
|
|||
int count = get_count();
|
||||
for (int ctr = 0; ctr < count; ctr++) {
|
||||
Geary.Conversation c = get_conversation_at_index(ctr);
|
||||
Gee.SortedSet<Geary.Email> mail = c.get_email(Geary.Conversation.Ordering.ID_DESCENDING);
|
||||
Gee.List<Geary.Email> mail = c.get_email(Geary.Conversation.Ordering.ID_DESCENDING);
|
||||
if (mail.size == 0)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
public int compare_conversation_ascending(Geary.Conversation a, Geary.Conversation b) {
|
||||
Gee.SortedSet<Geary.Email> apool = a.get_email(Geary.Conversation.Ordering.DATE_ASCENDING);
|
||||
Gee.SortedSet<Geary.Email> bpool = b.get_email(Geary.Conversation.Ordering.DATE_ASCENDING);
|
||||
Gee.List<Geary.Email> apool = a.get_email(Geary.Conversation.Ordering.DATE_ASCENDING);
|
||||
Gee.List<Geary.Email> bpool = b.get_email(Geary.Conversation.Ordering.DATE_ASCENDING);
|
||||
|
||||
if (apool.last() == null)
|
||||
return (bpool.last() != null) ? -1 : 0;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class Geary.DBus.Conversation : Object {
|
|||
}
|
||||
|
||||
public async ObjectPath[] get_emails() throws IOError {
|
||||
Gee.SortedSet<Geary.Email> pool = conversation.get_email(Geary.Conversation.Ordering.DATE_ASCENDING);
|
||||
Gee.List<Geary.Email> pool = conversation.get_email(Geary.Conversation.Ordering.DATE_ASCENDING);
|
||||
if (pool.size == 0)
|
||||
return new ObjectPath[0];
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
public abstract class Geary.Conversation : Object {
|
||||
public enum Ordering {
|
||||
ANY,
|
||||
NONE,
|
||||
DATE_ASCENDING,
|
||||
DATE_DESCENDING,
|
||||
ID_ASCENDING,
|
||||
|
|
@ -24,7 +24,7 @@ public abstract class Geary.Conversation : Object {
|
|||
/**
|
||||
* Returns all the email in the conversation sorted according to the specifier.
|
||||
*/
|
||||
public abstract Gee.SortedSet<Geary.Email> get_email(Ordering ordering);
|
||||
public abstract Gee.List<Geary.Email> get_email(Ordering ordering);
|
||||
|
||||
/**
|
||||
* Returns the email associated with the EmailIdentifier, if present in this conversation.
|
||||
|
|
@ -51,7 +51,7 @@ public abstract class Geary.Conversation : Object {
|
|||
}
|
||||
|
||||
private bool has_flag(Geary.EmailFlag flag) {
|
||||
foreach (Geary.Email email in get_email(Ordering.ANY)) {
|
||||
foreach (Geary.Email email in get_email(Ordering.NONE)) {
|
||||
if (email.properties != null && email.properties.email_flags.contains(flag))
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,25 +40,23 @@ public class Geary.Conversations : Object {
|
|||
return emails.size;
|
||||
}
|
||||
|
||||
public override Gee.SortedSet<Geary.Email> get_email(Conversation.Ordering ordering) {
|
||||
// TODO: Really would like to return a read-only view here, but Gee doesn't make that
|
||||
// easy ... since read_only_view simply makes a copy, perhaps there's no great loss
|
||||
// here. In either case, the email itself should never be copied; original references
|
||||
// must be returned, as Geary.Email is mutable
|
||||
public override Gee.List<Geary.Email> get_email(Conversation.Ordering ordering) {
|
||||
switch (ordering) {
|
||||
case Conversation.Ordering.DATE_ASCENDING:
|
||||
return date_ascending;
|
||||
return Collection.to_array_list<Email>(date_ascending);
|
||||
|
||||
case Conversation.Ordering.ID_ASCENDING:
|
||||
return id_ascending;
|
||||
return Collection.to_array_list<Email>(id_ascending);
|
||||
|
||||
case Conversation.Ordering.ID_DESCENDING:
|
||||
return id_descending;
|
||||
return Collection.to_array_list<Email>(id_descending);
|
||||
|
||||
case Conversation.Ordering.DATE_DESCENDING:
|
||||
case Conversation.Ordering.ANY:
|
||||
return Collection.to_array_list<Email>(date_descending);
|
||||
|
||||
case Conversation.Ordering.NONE:
|
||||
default:
|
||||
return date_descending;
|
||||
return Collection.to_array_list<Email>(emails.values);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
16
src/engine/util/util-collection.vala
Executable file
16
src/engine/util/util-collection.vala
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
/* Copyright 2012 Yorba Foundation
|
||||
*
|
||||
* This software is licensed under the GNU Lesser General Public License
|
||||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
namespace Geary.Collection {
|
||||
|
||||
public Gee.ArrayList to_array_list<G>(Gee.Collection<G> c) {
|
||||
Gee.ArrayList<G> list = new Gee.ArrayList<G>();
|
||||
list.add_all(c);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -149,6 +149,7 @@ def build(bld):
|
|||
'engine/state/state-machine.vala',
|
||||
'engine/state/state-mapping.vala',
|
||||
|
||||
'engine/util/util-collection.vala',
|
||||
'engine/util/util-converter.vala',
|
||||
'engine/util/util-html.vala',
|
||||
'engine/util/util-inet.vala',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue