Merge pull request #5637 from nextcloud/bugfix/fix-crash-ptr-deref

Edit locally. Fix crash on _chekTokenJob pointer deref.
This commit is contained in:
allexzander 2023-05-04 11:33:31 +02:00 committed by GitHub
commit cc697011b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -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)

View File

@ -106,7 +106,6 @@ private:
QString _localFilePath;
QString _folderRelativePath;
Folder *_folderForFile = nullptr;
std::unique_ptr<SimpleApiJob> _checkTokenJob;
QMetaObject::Connection _syncTerminatedConnection = {};
QVector<QMetaObject::Connection> _folderConnections;
};