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

Instances sometimes not being deleted from WrapperMapper causing wrong wrapper->cptr mapping

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.11.2
    • PySide, Shiboken
    • None
    • Windows

    Description

      I have got two situations where C++ Qt deletes some object and creates new one on the same address later, but the wrapper wasn't removed from WrapperMapper. When PySide wanted to retrieve wrapper fro the new cptr, it already found one in wrapper mapper sometimes with completely different class causing crashes.

      I'm attaching two patches to fix those issues

      Patch 1 : this was sadly long time ago, so I don't exactly remember what was directly happening, but my code was generating a lot of QSocket objects and eventually addresses got reused and crash happened. Also the crash was happening only on embedded PySide inside Autodesk 3dsMax, but this patch fixed the crash and didn't cause any problems, so it mght be worth integrating it.

       

      Patch 2 : when moving widgets between parents, Qt in the background gets QWidgetItem instances and manually deletes them. But if QWidgetItem was previously requested by PySide the wrapper was not being deleted and was pointing to invalid cptr. Eventually this cptr was replaced by new instance, and when wrapper has been requested for the cptr, the wrapper for QWidgetItem was returned ( in my case, one of my eventFilters was receiving QWidgetItem instance instead of QEvent) The fix was to use same logic as Qt to determine the QwidgetITem to be deleted and delete wrapper manually on every occasion it is deleted in the C++.

      Attachments

        1. patch1.diff
          5 kB
          Roman Zawada
        2. patch2.diff
          1 kB
          Roman Zawada
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            zwadar.cz Roman Zawada
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes