Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Segmentation fault when using QImage in a plugin
Qt 6.11 is out! See what's new in the release blog

Segmentation fault when using QImage in a plugin

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello,
    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!

    EDIT:
    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.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved