From cdf2c390cab571acfaa0771e9c7e076aeb8c4df4 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Tue, 25 Apr 2023 15:19:49 +0200 Subject: [PATCH] Don't abandon job when image request is cancelled Aborting the request causes a lot of logged messages. In theory, not stopping the job causes some overhead, but that's negligible and the provider is on its way out anyway. --- src/matriximageprovider.cpp | 17 ----------------- src/matriximageprovider.h | 2 -- 2 files changed, 19 deletions(-) diff --git a/src/matriximageprovider.cpp b/src/matriximageprovider.cpp index f363e91f8..838cdacb6 100644 --- a/src/matriximageprovider.cpp +++ b/src/matriximageprovider.cpp @@ -98,18 +98,6 @@ void ThumbnailResponse::prepareResult() Q_EMIT finished(); } -void ThumbnailResponse::doCancel() -{ - if (!Controller::instance().activeConnection()) { - return; - } - // Runs in the main thread, not QML thread - if (job) { - Q_ASSERT(QThread::currentThread() == job->thread()); - job->abandon(); - } -} - QQuickTextureFactory *ThumbnailResponse::textureFactory() const { QReadLocker _(&lock); @@ -122,11 +110,6 @@ QString ThumbnailResponse::errorString() const return errorStr; } -void ThumbnailResponse::cancel() -{ - QMetaObject::invokeMethod(this, &ThumbnailResponse::doCancel, Qt::QueuedConnection); -} - QQuickImageResponse *MatrixImageProvider::requestImageResponse(const QString &id, const QSize &requestedSize) { return new ThumbnailResponse(id, requestedSize); diff --git a/src/matriximageprovider.h b/src/matriximageprovider.h index e41554c3f..5af739f34 100644 --- a/src/matriximageprovider.h +++ b/src/matriximageprovider.h @@ -25,7 +25,6 @@ public: private Q_SLOTS: void startRequest(); void prepareResult(); - void doCancel(); private: const QString mediaId; @@ -39,7 +38,6 @@ private: QQuickTextureFactory *textureFactory() const override; QString errorString() const override; - void cancel() override; }; class MatrixImageProvider : public QQuickAsyncImageProvider