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

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.1.0 RC1
    • 5.0.2
    • GUI: OpenGL
    • None
    • Qt 5.0.2 on Mac OSX 10.8.3
    • 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

        1. TestGL.zip
          6 kB
          Günter Woigk

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: