Account removal: More crash fixes for Windows

Seems things happen a bit different here, maybe because of paint events.

For #4229 #4202
This commit is contained in:
Markus Goetz 2015-12-01 19:21:52 +01:00
Родитель db7d70a929
Коммит c24a8ba208
2 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -689,6 +689,7 @@ void AccountSettings::slotDeleteAccount()
}
}
_model->setAccountState(0); // Else it might access during destruction. This should be better handled by it having a QSharedPointer
auto manager = AccountManager::instance();
manager->deleteAccount(_accountState);
manager->save();

Просмотреть файл

@ -53,6 +53,8 @@ void FolderStatusModel::setAccountState(const AccountState* accountState)
auto folders = FolderMan::instance()->map();
foreach (auto f, folders) {
if (!accountState)
break;
if (f->accountState() != accountState)
continue;
SubFolderInfo info;
@ -74,6 +76,9 @@ void FolderStatusModel::setAccountState(const AccountState* accountState)
Qt::ItemFlags FolderStatusModel::flags ( const QModelIndex &index ) const
{
if (!_accountState) {
return 0;
}
switch (classify(index)) {
case AddButton: {
Qt::ItemFlags ret;
@ -479,6 +484,9 @@ bool FolderStatusModel::hasChildren(const QModelIndex& parent) const
bool FolderStatusModel::canFetchMore(const QModelIndex& parent) const
{
if (!_accountState) {
return false;
}
if (_accountState->state() != AccountState::Connected) {
return false;
}