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

Crash upon exit after QUiLoader::load with custom widgets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.0, 6.4.3
    • 6.x
    • PySide
    • None
    • All
    • 2379fbd9f (dev), 9b12737a3 (6.4)

    Description

      Running PySide6 any version, Python 3.10/3.11 on Windows 11/Debian 11.6.

      Running the example code, as is, as can be found in;
      https://doc.qt.io/qtforpython/tutorials/basictutorial/uifiles.html#option-b-loading-it-directly
      i.e. copy/paste example code in main.py and mainwindow.ui

      main.py crashes upon exit when the 'custom widget' mechanism is used.

      For the 'custom widget' mechanism refer to;
      https://doc.qt.io/qtforpython/tutorials/basictutorial/uifiles.html#custom-widgets-in-qt-designer

      To deploy the custom widget mechanism do the following;

      • Add a PYSIDE_DESIGNER_PLUGINS environment variable and set it with the path to a folder holding,
      • a register*.py file (can be empty) holding the custom widget registration code

      main.py now crashes upon exit. Post mortem analysis reveals;

      Unhandled exception thrown: read access violation.
      tstate was nullptr.
      > python311.dll!import_get_module(_ts * tstate, _object * name) Line 314    
        python311.dll!PyImport_GetModule(_object * name) Line 1764
        python311.dll!wait_for_thread_shutdown(_ts * tstate) Line 2894
        python311.dll!Py_FinalizeEx() Line 1767

      Without the environment variable or register*.py file or both, main.py does not crash.

      With PySide2, main.py does not crash.

       

      Can this be caused by the PySidePlugin.dll.PyDesignerCustomWidgets::PyDesignerCustomWidgets which does a Py_Initialize?

      This is fine in an application embedding Python, i.e. Qt Designer but not in a Python interpreter, i.e. in a Python script.

      Attachments

        1. pyside2222_stack.txt
          37 kB
        2. pyside2222.zip
          2 kB
        3. PYSIDE-2222.zip
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            owillebo Okko Willeboordse
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes