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

Crash when using nameparameter in debug mode

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.15
    • 5.15.15
    • Shiboken
    • None
    • Windows
    • d51a393db5 (pyside/tqtc-pyside-setup/5.15) d51a393db5 (pyside/tqtc-pyside-setup/tqtc/5.15)

    Description

      Hello,

      I’m integrating the 5.15.8 version of both Qt and the corresponding QtForPython and I found what looks like an issue.
      In the file generated for QIcon, I’ve got the function Sbk_QIconFunc_addFile which is doing, in case of using named parameters (if (kwds)):

      • Copy in a auto dec ref object kwds: Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
        * At the end when the dictionary is empty, it decrease it:
 
            if (PyDict_Size(kwds_dup) > 0) {
                      errInfo = kwds_dup.release();
                      goto Sbk_QIconFunc_addFile_TypeError;
            } else {
                      Py_DECREF(kwds_dup);
            }
         
      • When the scope ends, since it’s an AutoDecRef, it decrease again and goes bellow 0.

      To reproduce:

      • Use a debug build.
      • Create a QIcon.
      • Call the addFile method with named parameters.

      In debug, there is an assert check on the counter and it fails when using nameparameters.

      It looks like this backport introduce the issue: https://codereview.qt-project.org/c/pyside/tqtc-pyside-setup/+/379410/3/sources/shiboken2/generator/shiboken2/cppgenerator.cpp

      Do you confirm this analysis?

      Attachments

        1. pyside1881_nonrepro.zip
          2 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            jcaux@adobe.com Jonathan Caux
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes