Fix segfault/assert when logging out of account
This commit is contained in:
@@ -196,7 +196,7 @@ void Controller::logout(Connection *conn, bool serverSideLogout)
|
|||||||
conn->stopSync();
|
conn->stopSync();
|
||||||
Q_EMIT conn->stateChanged();
|
Q_EMIT conn->stateChanged();
|
||||||
Q_EMIT conn->loggedOut();
|
Q_EMIT conn->loggedOut();
|
||||||
if (!m_connections.isEmpty()) {
|
if (conn == activeConnection() && !m_connections.isEmpty()) {
|
||||||
setActiveConnection(m_connections[0]);
|
setActiveConnection(m_connections[0]);
|
||||||
} else {
|
} else {
|
||||||
setActiveConnection(nullptr);
|
setActiveConnection(nullptr);
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ ThumbnailResponse::ThumbnailResponse(QString id, QSize size)
|
|||||||
|
|
||||||
void ThumbnailResponse::startRequest()
|
void ThumbnailResponse::startRequest()
|
||||||
{
|
{
|
||||||
|
if (!Controller::instance().activeConnection()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Runs in the main thread, not QML thread
|
// Runs in the main thread, not QML thread
|
||||||
Q_ASSERT(QThread::currentThread() == Controller::instance().activeConnection()->thread());
|
Q_ASSERT(QThread::currentThread() == Controller::instance().activeConnection()->thread());
|
||||||
job = Controller::instance().activeConnection()->getThumbnail(mediaId, requestedSize);
|
job = Controller::instance().activeConnection()->getThumbnail(mediaId, requestedSize);
|
||||||
@@ -94,6 +97,9 @@ void ThumbnailResponse::prepareResult()
|
|||||||
|
|
||||||
void ThumbnailResponse::doCancel()
|
void ThumbnailResponse::doCancel()
|
||||||
{
|
{
|
||||||
|
if (!Controller::instance().activeConnection()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Runs in the main thread, not QML thread
|
// Runs in the main thread, not QML thread
|
||||||
if (job) {
|
if (job) {
|
||||||
Q_ASSERT(QThread::currentThread() == job->thread());
|
Q_ASSERT(QThread::currentThread() == job->thread());
|
||||||
|
|||||||
Reference in New Issue
Block a user