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

QToolButton.setMenu() leaks and crashes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.11.0
    • None
    • PySide
    • None
    • fb6e9437180979936ea0b09263ac087707a05d2c (pyside/dev,30.8.2016)

    Description

      QToolButton.setMenu() adds a reference to the QMenu instance but never decrease the reference counter.

      import sys
      from PySide2.QtWidgets import *
      
      a = QToolButton()
      b = QMenu()
      print sys.getrefcount(b) # =2
      a.setMenu(b)
      print sys.getrefcount(b) # =3
      a.setMenu(None)
      print sys.getrefcount(b) # =3?
      
      del a
      del b
      # QMenu::~QMenu() is not invoked
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            mingxiang Mingxiang Xu
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes