diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 83a6d692d..04a59c3e2 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -2288,20 +2288,23 @@ public class MessageList } public void pruneDirtyMessages() { - Iterator iter = mAdapter.messages.iterator(); - while (iter.hasNext()) + synchronized (mAdapter.messages) { - MessageInfoHolder holder = iter.next(); - if (holder.dirty) + Iterator iter = mAdapter.messages.iterator(); + while (iter.hasNext()) { - if (holder.selected) + MessageInfoHolder holder = iter.next(); + if (holder.dirty) { - mSelectedCount--; - toggleBatchButtons(); + if (holder.selected) + { + mSelectedCount--; + toggleBatchButtons(); + } + mAdapter.removeMessage(holder); } - iter.remove(); } - } + } } public void removeMessages(List holders)