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
This commit is contained in:
Andrew Stadler 2009-10-13 12:02:46 -07:00
parent 2c74ee56a4
commit 754240bcf3

View File

@ -752,6 +752,9 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
*/
private boolean testMultiple(Set<Long> 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);