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

RuntimeError: Internal C++ object (PySide6.QtWidgets.QLabel) already deleted.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.4.1
    • PySide, Shiboken
    • None
    • linux, pyside 6.4.1, , shiboken 6.4.1
    • Linux/X11

    Description

      Reusing the sample program from issue 2121 and writing

      QMetaObject.invokeMethod(self, "setText", connection_type, Q_ARG(QObject, QLabel("Status")))
      

      I get

      $ python pysideXXX.py  
      Python 3.10.8
      Qt 6.4.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 12.2.0) [limited API]
      Window.__init__: MainThread
      asynch: Thread-1 (asynch)
      Window.setStatus: Thread-1 (asynch)
      Invoking using ConnectionType.BlockingQueuedConnection
      Window.setText: MainThread
      
      Traceback (most recent call last):
        File "/home/wolfgang/lib/python/qtgl/test/pysideXXX.py", line 27, in setText
          self.__statusLabel.setText(obj.text())
      
      RuntimeError: Internal C++ object (PySide6.QtWidgets.QLabel) already deleted.
      
      

      which means that the QLabel is already gone. Defining the QLabel as a variable and re-using it inside of invokeMethod resolves the isssue.

      Attachments

        Issue Links

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              wolf.seifert Wolfgang Seifert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: