diff options
Diffstat (limited to 'lib/accountregistry.cpp')
-rw-r--r-- | lib/accountregistry.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/accountregistry.cpp b/lib/accountregistry.cpp index 289f20dd..2cab54a3 100644 --- a/lib/accountregistry.cpp +++ b/lib/accountregistry.cpp @@ -21,10 +21,11 @@ void AccountRegistry::add(Connection* a) void AccountRegistry::drop(Connection* a) { - const auto idx = indexOf(a); - beginRemoveRows(QModelIndex(), idx, idx); - remove(idx); - endRemoveRows(); + if (const auto idx = indexOf(a); idx != -1) { + beginRemoveRows(QModelIndex(), idx, idx); + remove(idx); + endRemoveRows(); + } Q_ASSERT(!contains(a)); } @@ -134,3 +135,10 @@ QStringList AccountRegistry::accountsLoading() const { return m_accountsLoading; } + +AccountRegistry::~AccountRegistry() +{ + for (const auto& connection : *this) { + connection->saveState(); + } +} |