Fix NPE caused by I34451000

It's unfortunate but some of the fields we cleared in I34451000 are accessed
in BG threads or after the activity is destroyed.  We could add != null checks
everywhere, but it'll be a mess.  I also think it's safer to simply remove
the "= null" lines.

On the other hand, clearing AsyncTasks are relatively safer because they are
kept only so that we can cancel them afterwards, so I kept them.  But let me
know if you want to revert the original CL.

Bug 2570603

Change-Id: I04a10dd7382bfcceb686c3e9af92f8949caf619e
This commit is contained in:
Makoto Onuki 2010-04-08 11:50:58 -07:00
parent 60ee205963
commit 78e06eb894
5 changed files with 3 additions and 19 deletions

View File

@ -214,11 +214,9 @@ public class AccountFolderList extends ListActivity implements OnItemClickListen
Utility.cancelTask(mDeleteAccountTask, false); // Don't interrupt if it's running.
mDeleteAccountTask = null;
mListAdapter.changeCursor(null);
mListAdapter = null;
mHandler = null;
mControllerCallback = null;
if (mListAdapter != null) {
mListAdapter.changeCursor(null);
}
}
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

View File

@ -199,9 +199,6 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
mMessageCountTask = null;
mListAdapter.changeCursor(null);
mListAdapter = null;
mHandler = null;
mControllerCallback = null;
}
public void onClick(View v) {

View File

@ -396,18 +396,13 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
if (mAddressAdapterTo != null) {
mAddressAdapterTo.changeCursor(null);
mAddressAdapterTo = null;
}
if (mAddressAdapterCc != null) {
mAddressAdapterCc.changeCursor(null);
mAddressAdapterCc = null;
}
if (mAddressAdapterBcc != null) {
mAddressAdapterBcc.changeCursor(null);
mAddressAdapterBcc = null;
}
mHandler = null;
mListener = null;
}
/**

View File

@ -328,9 +328,6 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
mSetFooterTask = null;
mListAdapter.changeCursor(null);
mListAdapter = null;
mHandler = null;
mControllerCallback = null;
}
@Override

View File

@ -502,9 +502,6 @@ public class MessageView extends Activity implements OnClickListener {
mMessageContentView = null;
}
// the cursor was closed in onPause()
mHandler = null;
mControllerCallback = null;
}
private void onDelete() {