Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-43766

QPainter + QImage + QThread = undefined behaviour

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.0.2, 5.1.1, 5.2.1, 5.3.2, 5.4.0
    • GUI: Painting
    • None

    Description

      The docs state that you can paint with a QPainter on a QImage outside the GUI thread.

      But that's wrong.

      For drawing anything, you need a QPen or a QBrush. A QPen contains a QBrush, so you always need a QBrush. A QBrush may have a texture, and if it does, the simple act of comparing the brush to itself will create a QPixmap, even if the texture was originally set as a QImage.

      I'm working on a patch for that specific problem (comparing QBrush), but the fact is that neither QPen nor QBrush are documented to be reentrant, and thus not even completely dissociated instances of these types can officially be used outside the GUI thread.

      If this is a documentation bug, the fix is easy, but I believe that the use-case is supposed to supported, and that will be a big problem.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            mmutz Marc Mutz
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes