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

using QThread + QPainter + QGLWidget + QImage results in crash in 5.0.2, seems to work in 4.8.3

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.0.2
    • Fix Version/s: 5.1.0 RC1
    • Component/s: GUI: OpenGL
    • Labels:
      None
    • Environment:
      Qt 5.0.2 on Mac OSX 10.8.3
    • Commits:
      72768c089a431eafcc816413c247c8b8d896fdce

      Description

      I update a QGLWidget in a separate thread.
      Therefore i use a QImage and a QPainter to prepare an offscreen image and then i draw this into the QGLWidget using another QPainter with method drawImage().
      After some calls to this update process the app aborts with "Cannot make QOpenGLContext current in a different thread" on the terminal.
      In the attached example in testglwidget.cpp line 11:
      if disabled, works with Qt4.8.3 and Qt 5.0.2
      if enabled works with Qt 4.8.3 and crashes after some time with Qt 5.0.2.
      5.0.2: Stack trace contains only Qt and OS methods.
      4.8.3: says "QPixmap: It is not safe to use pixmaps outside the GUI thread" but i don't use any.

      This is a reduced test case of my app, where things are actually worse.
      Just painting into an existing QImage causes the crash in 5.0.2.
      Painting into the existing QImage by directly "poking" the pixels into the bits[] avoiding a QPainter didn't crash, but then drawing this QImage with a QPainter with drawImage() into the QGLWidget only very occassionally actually copied the image.

        Attachments

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

          Activity

            People

            Assignee:
            rodal Samuel Rødal
            Reporter:
            kio Günter Woigk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes