Fix segfault when closing an account that's not open.

Don't call Engine.get_account_instance when closing an account, it may
try to re-open one that is already closed.
This commit is contained in:
Michael James Gratton 2018-07-29 12:53:53 +10:00
parent 69dfc09656
commit 87b7e4daf6

View file

@ -1255,15 +1255,6 @@ public class GearyController : Geary.BaseObject {
}
debug("Account closed: %s", account.to_string());
// If there are no accounts available, exit. (This can happen if the user declines to
// enter a password on their account.)
try {
if (get_num_open_accounts() == 0)
this.application.exit();
} catch (Error e) {
message("Error enumerating accounts: %s", e.message);
}
}
/**
@ -1307,18 +1298,6 @@ public class GearyController : Geary.BaseObject {
return 0; // on error
}
// Returns the number of open accounts.
private int get_num_open_accounts() throws Error {
int num = 0;
foreach (Geary.AccountInformation info in Geary.Engine.instance.get_accounts().values) {
Geary.Account a = Geary.Engine.instance.get_account_instance(info);
if (a.is_open())
num++;
}
return num;
}
private bool is_inbox_descendant(Geary.Folder target) {
bool is_descendent = false;