From 05067556a295dc5e01a97a54c625a1776611c8dd Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Tue, 31 May 2022 00:08:48 +0200 Subject: Save connection state when destructing accountregistry --- lib/accountregistry.cpp | 7 +++++++ lib/accountregistry.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/lib/accountregistry.cpp b/lib/accountregistry.cpp index b40d5ecf..ab8c46e3 100644 --- a/lib/accountregistry.cpp +++ b/lib/accountregistry.cpp @@ -125,3 +125,10 @@ QStringList AccountRegistry::accountsLoading() const { return m_accountsLoading; } + +AccountRegistry::~AccountRegistry() +{ + for (const auto& connection : *this) { + connection->saveState(); + } +} diff --git a/lib/accountregistry.h b/lib/accountregistry.h index 38cfe6c6..959c7d42 100644 --- a/lib/accountregistry.h +++ b/lib/accountregistry.h @@ -42,6 +42,8 @@ public: [[deprecated("Use Accounts variable instead")]] // static AccountRegistry& instance(); + ~AccountRegistry(); + // Expose most of QVector's const-API but only provide add() and drop() // for changing it. In theory other changing operations could be supported // too; but then boilerplate begin/end*() calls has to be tucked into each -- cgit v1.2.3