Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Segmentation fault when using QImage in a plugin
chrismile last edited by
I'm trying to use Qt 5.1 in a plugin for a project of mine to render SVG files on Windows 8 (with MinGW).
I've downloaded the Qt MinGW package from qt-project.org/downloads, but I have problems using it:
Filling an image with a color, like in the following code, results in a segmentation fault.
@QImage Image(iWidth, iHeight, QImage::Format_ARGB32);
Image.fill(QColor(255, 255, 255, 0));
When I debug the program, I can see that the program crashes in the function qt_memfill32_sse2 in qdrawhelper_sse2.cpp in the following line:
@const __m128i value128 = _mm_set_epi32(value, value, value, value);
I think the problem is that I'm using a different version of MinGW (a precompiled mingw-w64-x86_32 package) for compiling my program than Qt is compiled with and the version my program uses probably has no SSE/MMX/... support.
However, after I have tried to solve the problem by replacing the libraries libgcc_s_dw2-1.dll and libstdc++-6.dll of the MinGW version that probably lacks SSE/MMX support with the Qt MinGW version files, nothing has changed.
I also tried to write an independent Qt Application in Qt Creator with this code – and in this case filling the image works as it should.
Does someone know how I could solve this problem that this code only crashes when I load the generated DLL file in my application?
Thanks for your answers in advance!
I just compared the MinGW version Qt uses with the MinGW version my program is compiled with - and it seems they are identical. I'm now even more perplexed about what is the reason for this problem.
chrismile last edited by
I found out that a bugreport for a very similar problem was created some years ago and it seems not to have anything to do with my second MinGW compiler: https://bugreports.qt-project.org/browse/QTBUG-14272
What would you advise me to do?
Should I compile Qt with mstackrealign? Or, as someone in the bugreport said that only this helped him, should I disable SSE2 in the build?
bq. We compiled Qt with the option -mstackrealign and this solved the issue for a while. But now we installed our application and the libraries on another machine (Windows XP SP3) and the same problem occured. So compiling Qt with -mstackrealign does not solve the issue for all Windows machines.
The only solution at the moment seems to be to disable SSE2 support.
Or is there any other thing I could do?