From: Claudio Cambra Date: Thu, 11 May 2023 13:27:06 +0000 (+0800) Subject: Do not close putmultifilejob devices if not open, log when they are not open X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~10^2~51^2~8 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=651615ce946ae1090777f96a3885b9db6a95d905;p=nextcloud-desktop.git Do not close putmultifilejob devices if not open, log when they are not open Signed-off-by: Claudio Cambra --- diff --git a/src/libsync/putmultifilejob.cpp b/src/libsync/putmultifilejob.cpp index b1d942c8e..67204a2a9 100644 --- a/src/libsync/putmultifilejob.cpp +++ b/src/libsync/putmultifilejob.cpp @@ -71,15 +71,22 @@ void PutMultiFileJob::start() bool PutMultiFileJob::finished() { - for(const auto &oneDevice : _devices) { - oneDevice._device->close(); - } - qCInfo(lcPutMultiFileJob) << "POST of" << reply()->request().url().toString() << path() << "FINISHED WITH STATUS" << replyStatusString() << reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute) << reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute); + for(const auto &oneDevice : _devices) { + Q_ASSERT(oneDevice._device); + + if (oneDevice._device->isOpen()) { + oneDevice._device->close(); + } else { + qCWarning(lcPutMultiFileJob) << "Did not close device" << oneDevice._device.get() + << "as it was not open"; + } + } + emit finishedSignal(); return true; }