1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Fix leaked window error in FolderList

Observed after wiping data and then tapping a launcher shortcut
for an account.
This commit is contained in:
Joe Steele 2014-07-15 12:16:05 -04:00
parent fe49a5f005
commit 41570e4305

View File

@ -99,6 +99,8 @@ public class FolderList extends K9ListActivity {
private TextView mActionBarSubTitle;
private TextView mActionBarUnread;
private boolean mIsFinished = false;
class FolderListHandler extends Handler {
public void refreshTitle() {
@ -277,10 +279,18 @@ public class FolderList extends K9ListActivity {
mInflater = getLayoutInflater();
onNewIntent(getIntent());
context = this;
onNewIntent(getIntent());
if (mIsFinished) {
/*
* onNewIntent() may call finish(), but execution will still continue here.
* We return now because we don't want to display the changelog which can
* result in a leaked window error.
*/
return;
}
ChangeLog cl = new ChangeLog(this);
if (cl.isFirstRun()) {
cl.getLogDialog().show();
@ -308,7 +318,12 @@ public class FolderList extends K9ListActivity {
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
if (mAccount == null) {
// This shouldn't normally happen. But apparently it does. See issue 2261.
/*
* This can happen when a launcher shortcut is created for an
* account, and then the account is deleted or data is wiped, and
* then the shortcut is used.
*/
mIsFinished = true;
finish();
return;
}
@ -316,6 +331,7 @@ public class FolderList extends K9ListActivity {
if (intent.getBooleanExtra(EXTRA_FROM_SHORTCUT, false) &&
!K9.FOLDER_NONE.equals(mAccount.getAutoExpandFolderName())) {
onOpenFolder(mAccount.getAutoExpandFolderName());
mIsFinished = true;
finish();
} else {
initializeActivityView();