From cda8da3e9601fc15b633d6c7ceee3d59f3cb7f97 Mon Sep 17 00:00:00 2001 From: alex-z Date: Fri, 28 Apr 2023 14:45:07 +0200 Subject: [PATCH] Edit locally. Fix crash on _chekTokenJob pointer deref. Signed-off-by: alex-z --- src/gui/editlocallyjob.cpp | 12 ++++++------ src/gui/editlocallyjob.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gui/editlocallyjob.cpp b/src/gui/editlocallyjob.cpp index cf2c108226..18055d8d6b 100644 --- a/src/gui/editlocallyjob.cpp +++ b/src/gui/editlocallyjob.cpp @@ -98,16 +98,16 @@ void EditLocallyJob::startTokenRemoteCheck() const auto encodedToken = QString::fromUtf8(QUrl::toPercentEncoding(_token)); // Sanitise the token const auto encodedRelPath = QUrl::toPercentEncoding(_relPath); // Sanitise the relPath - _checkTokenJob.reset(new SimpleApiJob(_accountState->account(), - QStringLiteral("/ocs/v2.php/apps/files/api/v1/openlocaleditor/%1").arg(encodedToken))); + const auto checkTokenJob = new SimpleApiJob(_accountState->account(), + QStringLiteral("/ocs/v2.php/apps/files/api/v1/openlocaleditor/%1").arg(encodedToken)); QUrlQuery params; params.addQueryItem(QStringLiteral("path"), prefixSlashToPath(encodedRelPath)); - _checkTokenJob->addQueryParams(params); - _checkTokenJob->setVerb(SimpleApiJob::Verb::Post); - connect(_checkTokenJob.get(), &SimpleApiJob::resultReceived, this, &EditLocallyJob::remoteTokenCheckResultReceived); + checkTokenJob->addQueryParams(params); + checkTokenJob->setVerb(SimpleApiJob::Verb::Post); + connect(checkTokenJob, &SimpleApiJob::resultReceived, this, &EditLocallyJob::remoteTokenCheckResultReceived); - _checkTokenJob->start(); + checkTokenJob->start(); } void EditLocallyJob::remoteTokenCheckResultReceived(const int statusCode) diff --git a/src/gui/editlocallyjob.h b/src/gui/editlocallyjob.h index 8eeaa4afbb..06364fba96 100644 --- a/src/gui/editlocallyjob.h +++ b/src/gui/editlocallyjob.h @@ -106,7 +106,6 @@ private: QString _localFilePath; QString _folderRelativePath; Folder *_folderForFile = nullptr; - std::unique_ptr _checkTokenJob; QMetaObject::Connection _syncTerminatedConnection = {}; QVector _folderConnections; };