From 6532dc5d37668947f59cc0dff1fd10a2e040f6cd Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 9 Nov 2023 11:25:39 +0100 Subject: [PATCH] Fix multiple threads accessing same byte We can not thread mono image formats as the bit access isn't atomic. Pick-to: 6.6 6.5 Fixes: QTBUG-117494 Change-Id: Ica8e08fc3da73983f6b4da2a133f5e715fd0d787 Reviewed-by: Eirik Aavitsland --- src/gui/painting/qdrawhelper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 1c62d54fcdb..117f43db8fd 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -3779,7 +3779,8 @@ static void spanfill_from_first(QRasterBuffer *rasterBuffer, QPixelLayout::BPP b #define QT_THREAD_PARALLEL_FILLS(function) \ const int segments = (count + 32) / 64; \ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance(); \ - if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) { \ + if (segments > 1 && qPixelLayouts[data->rasterBuffer->format].bpp >= QPixelLayout::BPP8 \ + && threadPool && !threadPool->contains(QThread::currentThread())) { \ QSemaphore semaphore; \ int c = 0; \ for (int i = 0; i < segments; ++i) { \