From 0fe0f45944c0e71f97ff1235dcc2244b809d754e Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Mon, 28 Dec 2020 00:07:37 +0000 Subject: [PATCH] Fix segfault/assert when logging out of account --- src/controller.cpp | 2 +- src/matriximageprovider.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controller.cpp b/src/controller.cpp index 4c72a0948..85cdc28f2 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -196,7 +196,7 @@ void Controller::logout(Connection *conn, bool serverSideLogout) conn->stopSync(); Q_EMIT conn->stateChanged(); Q_EMIT conn->loggedOut(); - if (!m_connections.isEmpty()) { + if (conn == activeConnection() && !m_connections.isEmpty()) { setActiveConnection(m_connections[0]); } else { setActiveConnection(nullptr); diff --git a/src/matriximageprovider.cpp b/src/matriximageprovider.cpp index b9c632d72..80644b2d2 100644 --- a/src/matriximageprovider.cpp +++ b/src/matriximageprovider.cpp @@ -54,6 +54,9 @@ ThumbnailResponse::ThumbnailResponse(QString id, QSize size) void ThumbnailResponse::startRequest() { + if (!Controller::instance().activeConnection()) { + return; + } // Runs in the main thread, not QML thread Q_ASSERT(QThread::currentThread() == Controller::instance().activeConnection()->thread()); job = Controller::instance().activeConnection()->getThumbnail(mediaId, requestedSize); @@ -94,6 +97,9 @@ void ThumbnailResponse::prepareResult() void ThumbnailResponse::doCancel() { + if (!Controller::instance().activeConnection()) { + return; + } // Runs in the main thread, not QML thread if (job) { Q_ASSERT(QThread::currentThread() == job->thread());