From 999ec716d5e2b03aceb562e730edf3939eb2578a Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Mon, 30 May 2022 15:23:39 +0200 Subject: Emit loggedOut() after the access token is gone ...not before. --- lib/connection.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/connection.cpp') diff --git a/lib/connection.cpp b/lib/connection.cpp index 7e36b3c9..b7f49546 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -398,7 +398,7 @@ public: //TODO error handling } - void removeAccessTokenFromKeychain() + void dropAccessToken() { qCDebug(MAIN) << "Removing access token from keychain for" << q->userId(); auto job = new QKeychain::DeletePasswordJob(qAppName()); @@ -411,6 +411,8 @@ public: pickleJob->setKey(q->userId() + "-Pickle"_ls); pickleJob->start(); //TODO error handling + + data->setToken({}); } }; @@ -727,10 +729,9 @@ void Connection::logout() || d->logoutJob->error() == BaseJob::ContentAccessError) { if (d->syncLoopConnection) disconnect(d->syncLoopConnection); - d->data->setToken({}); - emit loggedOut(); SettingsGroup("Accounts").remove(userId()); - d->removeAccessTokenFromKeychain(); + d->dropAccessToken(); + emit loggedOut(); deleteLater(); } else { // logout() somehow didn't proceed - restore the session state emit stateChanged(); -- cgit v1.2.3