mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Merge pull request #601 from artbristol/art/fix-race-alternative
Remove references to Account instance when account is deleted
This commit is contained in:
commit
79b06cd0cc
@ -1074,7 +1074,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||||||
// are currently not inserted to be left
|
// are currently not inserted to be left
|
||||||
}
|
}
|
||||||
MessagingController.getInstance(getApplication())
|
MessagingController.getInstance(getApplication())
|
||||||
.notifyAccountCancel(Accounts.this, realAccount);
|
.deleteAccount(Accounts.this, realAccount);
|
||||||
Preferences.getPreferences(Accounts.this)
|
Preferences.getPreferences(Accounts.this)
|
||||||
.deleteAccount(realAccount);
|
.deleteAccount(realAccount);
|
||||||
K9.setServicesEnabled(Accounts.this);
|
K9.setServicesEnabled(Accounts.this);
|
||||||
|
@ -5126,6 +5126,11 @@ public class MessagingController implements Runnable {
|
|||||||
notificationData.remove(account.getAccountNumber());
|
notificationData.remove(account.getAccountNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteAccount(Context context, Account account) {
|
||||||
|
notifyAccountCancel(context, account);
|
||||||
|
memorizingListener.removeAccount(account);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a draft message.
|
* Save a draft message.
|
||||||
* @param account Account we are saving for.
|
* @param account Account we are saving for.
|
||||||
@ -5464,6 +5469,20 @@ public class MessagingController implements Runnable {
|
|||||||
return memory;
|
return memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized void removeAccount(Account account) {
|
||||||
|
Iterator<Entry<String, Memory>> memIt = memories.entrySet().iterator();
|
||||||
|
|
||||||
|
while (memIt.hasNext()) {
|
||||||
|
Entry<String, Memory> memoryEntry = memIt.next();
|
||||||
|
|
||||||
|
String uuidForMemory = memoryEntry.getValue().account.getUuid();
|
||||||
|
|
||||||
|
if (uuidForMemory.equals(account.getUuid())) {
|
||||||
|
memIt.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void synchronizeMailboxStarted(Account account, String folder) {
|
public synchronized void synchronizeMailboxStarted(Account account, String folder) {
|
||||||
Memory memory = getMemory(account, folder);
|
Memory memory = getMemory(account, folder);
|
||||||
|
Loading…
Reference in New Issue
Block a user