Details
-
Bug
-
Resolution: Cannot Reproduce
-
P1: Critical
-
None
-
6.5.3, 6.6.1
-
None
Description
Qimage::scaled never returns, because semaphore.acquire blocks in Qt code:
template<typename T> static inline void multithread_pixels_function(QImageScaleInfo *isi, int dh, const T &scaleSection) { #if QT_CONFIG(thread) && !defined(Q_OS_WASM) int segments = (qsizetype(isi->sh) * isi->sw) / (1<<16); segments = std::min(segments, dh); QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance(); if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) { QSemaphore semaphore; int y = 0; for (int i = 0; i < segments; ++i) { int yn = (dh - y) / (segments - i); threadPool->start([&, y, yn]() { scaleSection(y, y + yn); semaphore.release(1); }); y += yn; } semaphore.acquire(segments); return; } #endif scaleSection(0, dh); }
I debugged Qt code and it seems semaphore.acquire(segments); blocks. It seems all worker threads are destroyed.
This behavior does not always occur. There may be resource problems if scaleSelection is executed in parallel. The working threads seem to run into the tiemout (expiryTimeout). Is semaphore.release(1); possibly not executed in this case?