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

Crash when call to QPainter.device() in QGraphicsScene

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.11.2
    • Fix Version/s: 5.12.1
    • Component/s: PySide
    • Labels:
      None
    • Environment:
      Ubuntu 16.04
      Python 3.6
    • Platform/s:
      Linux/X11
    • Commits:
      e254c3c2aa140016e298107a0297885234abfde7 (pyside/pyside-setup/5.12)

      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_log.txt
          0.5 kB
        3. pyside868_qt_diag.diff
          1 kB
        4. pyside868_stack.txt
          52 kB
        5. pyside868.py
          1.0 kB
        For Gerrit Dashboard: PYSIDE-868
        # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes