Improve stability.

This commit is contained in:
Black Hat
2018-11-06 09:36:17 +08:00
parent 64603b47c6
commit 6e44347efd
4 changed files with 16 additions and 8 deletions

View File

@@ -40,7 +40,12 @@ Controller::Controller(QObject* parent)
QTimer::singleShot(0, this, SLOT(invokeLogin()));
}
Controller::~Controller() {}
Controller::~Controller() {
for (auto c : qAsConst(m_connections)) {
c->saveState();
c->stopSync();
}
}
inline QString accessTokenFileName(const AccountSettings& account) {
QString fileName = account.userId();
@@ -104,10 +109,7 @@ void Controller::addConnection(Connection* c) {
m_connections.push_back(c);
connect(c, &Connection::syncDone, this, [=] {
c->saveState();
c->sync(30000);
});
connect(c, &Connection::syncDone, this, [=] { c->sync(30000); });
connect(c, &Connection::loggedOut, this, [=] { dropConnection(c); });
using namespace QMatrixClient;