Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Segmentation fault when using QImage/QPainter functions (e.g. QImage::scaledToWidth, QPainter::drawImage) in certain situations

$
0
0
I’m working on the migration of a large Qt 4.8/mingw 4.4 application from Windows 7 to Windows 8. When watermarking images, I get a segmentation fault. It is possible to work around the bug (I’ve been able to get a half-decent looking result using clipping in place of the alpha channel). However I’m interested in figuring out if this is a bug in the Qt libraries – especially since we could get similar issues in the future if we do not have a good understanding of the bug. Configuration: – Qt 4.8.4, mingw 4.4. Qt 4.8.5 also crashed. – Windows 8.0 or 8.1 – The crash occurs on debug builds only, independently of whether or not a debugger is attached Crash scenario: – Have a GUI thread running – Create a QImage from a png file that has an alpha channel (=transparency) – Attempt to resize the image with QImage::scaledToWidth(width), but not in the GUI thread No crash if either is true: – OS is windows 7 – There is no alpha channel – The scaledToWidth call is made from the GUI thread – There is no concurrent GUI thread Stacktrace: 0 _mm_andnot_si128 emmintrin.h 1239 0×8a6572 1 comp_func_SourceOver_sse2 qdrawhelper_sse2.cpp 152 0×8a6572 2 BlendSrcGeneric<(SpanMethod)0>::process qdrawhelper.cpp 3581 0xf4cf7b 3 handleSpans<BlendSrcGeneric<(SpanMethod)0> > qdrawhelper.cpp 3527 0xf020eb 4 blend_src_generic<(SpanMethod)0> qdrawhelper.cpp 3599 0xa764a1 5 qBlendTexture qdrawhelper.cpp 6832 0xa67159 6 fillRect_normalized qpaintengine_raster.cpp 1494 0xa55b4b 7 QRasterPaintEngine::drawImage qpaintengine_raster.cpp 2407 0xa5a4db 8 QRasterPaintEngine::drawImage qpaintengine_raster.cpp 2169 0xa58ef8 9 QPainter::drawImage qpainter.cpp 5636 0×9eae0a 10 QPainter::drawImage qpainter.h 928 0×1047ca1 11 QImage::transformed qimage.cpp 6672 0×95861e 12 QImage::scaledToWidth qimage.cpp 4498 0×951c4b 13 WatermarkTest::watermark watermarktest.cpp 83 0×4023dd 14 QtConcurrent::StoredFunctorCall0<void, void (*)()>::runFunctor qtconcurrentstoredfunctioncall.h 74 0×407a96 15 QtConcurrent::RunFunctionTask<void>::run qtconcurrentrunbase.h 134 0×4078e3 16 QThreadPoolThread::run qthreadpool.cpp 107 0×69ccd310 17 QThreadPrivate::start qthread_win.cpp 346 0×69cd7eb5 18 wtoi64 C:\WINDOWS\SysWOW64\msvcrt.dll 0×76fb0bc4 19 msvcrt!_beginthreadex C:\WINDOWS\SysWOW64\msvcrt.dll 0×76fb0cec 20 KERNEL32!GetNumberOfConsoleFonts C:\WINDOWS\SysWOW64\kernel32.dll 0×74fc495d 21 ?? 0×773d98ee 22 ?? 0×773d98c4 23 ?? Notes about the stacktrace: emmintrin.h seems to be a MinGW file (not completely sure). The function that is macro-ed consists of a single line thanks to multiple “\”, but it seems (?) that the crash occurs on line 176 of emmintrin.h (based on the status of initialized variables at the time of the segmentation fault). I think this is very low level code for processing pixel value changes. I’m including code for a small application that reproduces the crash in a second post (due to the character limit).

Viewing all articles
Browse latest Browse all 13965

Trending Articles