Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-868

Crash when call to QPainter.device() in QGraphicsScene

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.12.1
    • 5.11.2
    • PySide
    • None
    • Ubuntu 16.04
      Python 3.6
    • Linux/X11
    • e254c3c2aa140016e298107a0297885234abfde7 (pyside/pyside-setup/5.12), ca3019f8a (dev), 531756af2 (6.7), 28d04cae2 (dev), e3d72705b (dev)

    Description

      When I try to call painter.device() in QGraphicsScene.drawForeground() method, I got

      Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
      

      Minimal working example:

      from PySide2 import QtWidgets
      
      
      class MyScene(QtWidgets.QGraphicsScene):
      
          def drawBackground(self, painter, rect):
              print(painter.device())
              painter.drawText(0, 0, 'Hi')
              super().drawBackground(painter, rect)
      
          def drawForeground(self, painter, rect):
              print(painter.device())
              print(painter.device().physicalDpiX())  # <-- this causes termination
              painter.drawText(30, 0, 'Hallo')
              super().drawForeground(painter, rect)
      
      
      if __name__ == '__main__':
          app = QtWidgets.QApplication([])
      
          scene = MyScene()
          scene.addText("Hello, world!")
          view = QtWidgets.QGraphicsView(scene)
          view.show()
      
          app.exec_()
      

      Attachments

        1. linux_gdb.txt
          10 kB
        2. pyside868_5.py
          1.0 kB
        3. pyside868_log.txt
          0.5 kB
        4. pyside868_log2.txt
          1 kB
        5. pyside868_qt_diag.diff
          1 kB
        6. pyside868_stack.txt
          52 kB
        7. pyside868.py
          1 kB
        For Gerrit Dashboard: PYSIDE-868
        # Subject Branch Project Status CR V

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            erakli erakli
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: