@@ -31,17 +31,19 @@ CroppedImageSizerAsyncWorker::CroppedImageSizerAsyncWorker(CroppedImageSizer *si
32void CroppedImageSizerAsyncWorker::abort()
32void CroppedImageSizerAsyncWorker::abort()
34+ // This runs on main thread
34 QMutexLocker locker(&m_mutex);
35 QMutexLocker locker(&m_mutex);
35 m_sizer = nullptr;
36 m_sizer = nullptr;
36 // If we already started the future run we can't abort the reply
37 // If we already started the future run we can't abort the reply
37 // since we don't know at which stage the future is, just let it finish
38 // since we don't know at which stage the future is, just let it finish
38 if (!m_ignoreAbort) {
39 if (!m_ignoreAbort) {
39− m_reply->abort();
40+ QMetaObject::invokeMethod(m_reply, "abort", Qt::QueuedConnection);
43void CroppedImageSizerAsyncWorker::requestFinished()
44void CroppedImageSizerAsyncWorker::requestFinished()
46+ // This runs on main thread
45 QMutexLocker locker(&m_mutex);
47 QMutexLocker locker(&m_mutex);
46 if (m_sizer) {
48 if (m_sizer) {
47 m_ignoreAbort = true;
49 m_ignoreAbort = true;
@@ -55,6 +57,7 @@ void CroppedImageSizerAsyncWorker::requestFinished()
56void CroppedImageSizerAsyncWorker::processRequestFinished(qreal width, qreal height, QUrl source, CroppedImageSizerAsyncWorker *worker)
58void CroppedImageSizerAsyncWorker::processRequestFinished(qreal width, qreal height, QUrl source, CroppedImageSizerAsyncWorker *worker)
60+ // This runs on non main thread
58 QImageReader reader(worker->m_reply);
61 QImageReader reader(worker->m_reply);
59 const QSize imageSize = reader.size();
62 const QSize imageSize = reader.size();
60 QSize sourceSize = QSize(0, 0);
63 QSize sourceSize = QSize(0, 0);