diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 97391093f..262110a77 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -2058,8 +2058,16 @@ public class MessageList addOrUpdateMessages(account, folder, messages, verifyAgainstSearch); } - private void addOrUpdateMessages(Account account, String folder, List messages, boolean verifyAgainstSearch) + private void addOrUpdateMessages(final Account account, final String folder, final List providedMessages, final boolean verifyAgainstSearch) { + // we copy the message list because the callback doesn't expect + // the callbacks to mutate it. + final List messages = new ArrayList(providedMessages); + + runOnUiThread(new Runnable() + { + public void run() + { boolean needsSort = false; final List messagesToAdd = new ArrayList(); List messagesToRemove = new ArrayList(); @@ -2133,6 +2141,8 @@ public class MessageList mHandler.sortMessages(); mHandler.resetUnreadCount(); } + } + }); } public MessageInfoHolder getMessage(Message message) {