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

REG->6.5: Memory leak connecting signal to local function

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4: Low P4: Low
    • 6.5.2, 6.6.0
    • 6.4.0, 6.4.1, 6.5.0, 6.5.1, 6.4.2, 6.4.3, 6.5.1.1
    • PySide
    • None
    • Windows
    • f0109334c (dev), 7222d8a04 (6.5), 46ab90a5f (dev), afffc5838 (6.5), 2f37a27b3 (dev), 1c6a6a4e4 (6.5)

      When use signal,  the connected local function can not be destroyed by python

      PYQT6.x not found this problem  

       

      import sys
      from PySide6.QtWidgets import *
      from PySide6.QtCore import *
      from PySide6.QtGui import *
      
      
      if __name__ == "__main__":
          app = QApplication(sys.argv)
      
          def func():
             button = QPushButton()
      
             def onClicked(text):
                print("=========clicked button:", text)
             button.clicked.connect(partial(onClicked, "demo"))
      
          def _run():
             import objgraph
             objgraph.show_growth()
             func()
             QTimer.singleShot(1000, _run)
      
          _run()
          app.exec()
      

      test.zip

       

        1. test.zip
          38 kB
          jerry hao
        2. testcode.png
          244 kB
          jerry hao
        3. pyside2371_log.txt
          2 kB
          Friedemann Kleint
        4. pyside2371.py
          1.0 kB
          Friedemann Kleint
        5. pyside2371_diag.diff
          6 kB
          Friedemann Kleint
        For Gerrit Dashboard: PYSIDE-2371
        # Subject Branch Project Status CR V

            kleint Friedemann Kleint
            jerryhao_ jerry hao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: