1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

do our messagelist updates from sync on the ui thread rather than the

sync thread. copy the incoming message list to deal with concurrent
access issues.  Patch by cketti++
This commit is contained in:
Jesse Vincent 2010-09-02 03:45:16 +00:00
parent 08f10f1fe5
commit 6573f27cec

View File

@ -2058,7 +2058,15 @@ public class MessageList
addOrUpdateMessages(account, folder, messages, verifyAgainstSearch); addOrUpdateMessages(account, folder, messages, verifyAgainstSearch);
} }
private void addOrUpdateMessages(Account account, String folder, List<Message> messages, boolean verifyAgainstSearch) private void addOrUpdateMessages(final Account account, final String folder, final List<Message> providedMessages, final boolean verifyAgainstSearch)
{
// we copy the message list because the callback doesn't expect
// the callbacks to mutate it.
final List<Message> messages = new ArrayList<Message>(providedMessages);
runOnUiThread(new Runnable()
{
public void run()
{ {
boolean needsSort = false; boolean needsSort = false;
final List<MessageInfoHolder> messagesToAdd = new ArrayList<MessageInfoHolder>(); final List<MessageInfoHolder> messagesToAdd = new ArrayList<MessageInfoHolder>();
@ -2134,6 +2142,8 @@ public class MessageList
mHandler.resetUnreadCount(); mHandler.resetUnreadCount();
} }
} }
});
}
public MessageInfoHolder getMessage(Message message) public MessageInfoHolder getMessage(Message message)
{ {
return getMessage(message.makeMessageReference()); return getMessage(message.makeMessageReference());