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

QToolButton.setMenu() leaks and crashes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: dev
    • Fix Version/s: 5.11.0
    • Component/s: PySide
    • Labels:
      None
    • Commits:
      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

            Assignee:
            kleint Friedemann Kleint
            Reporter:
            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