From 754240bcf3ccc8492a50ba9ee8056b34f6e4e8d0 Mon Sep 17 00:00:00 2001 From: Andrew Stadler Date: Tue, 13 Oct 2009 12:02:46 -0700 Subject: [PATCH] Fix race condition in testMultiple() * If we close the activity while a requeryList() is pending in the handler queue, we'll eventually try to operate on a closed cursor when we get to testMultiple(). * The fix: Return immediately if the cursor is not available. Fixes bug http://b/2180416 Followup for bug http://b/2149083 --- src/com/android/email/activity/MessageList.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/email/activity/MessageList.java b/src/com/android/email/activity/MessageList.java index d969b28e8..670504333 100644 --- a/src/com/android/email/activity/MessageList.java +++ b/src/com/android/email/activity/MessageList.java @@ -752,6 +752,9 @@ public class MessageList extends ListActivity implements OnItemClickListener, On */ private boolean testMultiple(Set selectedSet, int column_id, boolean defaultflag) { Cursor c = mListAdapter.getCursor(); + if (c == null || c.isClosed()) { + return false; + } c.moveToPosition(-1); while (c.moveToNext()) { long id = c.getInt(MessageListAdapter.COLUMN_ID);