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

Thread get stuck when executing QUiLoader()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.6.1
    • PySide
    • None
    • windows 10.0.22621.3007
      python 3.11.7
      pyside 6.6.1
    • Windows

      I found the thread stuck when executing the following:

      from PySide6 import QtWidgets
      from PySide6.QtUiTools import QUiLoader
      QtWidgets.QApplication([])
      QUiLoader()

      stack of the running thread:

      0x0000000000000000
      !NtDelayExecution+0x14
      !RtlDelayExecution+0x43
      !SwitchToThread+0x1b
      !DllMain+0x47b9b6
      !DllMain+0x47b6bf
      !DllMain+0x282ac9
      !DllMain+0x94733b
      !DrvSetContext+0xa7
      !DrvSetContext+0x3b
      !wglSwapLayerBuffers+0x885
      !wglMakeCurrent+0xd9
      !qt_plugin_query_metadata_v2+0x44b85
      !qt_plugin_query_metadata_v2+0x427b1
      !qt_plugin_query_metadata_v2+0x446b1
      !qt_plugin_query_metadata_v2+0x2161b
      !qt_plugin_query_metadata_v2+0x20b3b
      !QOpenGLContext::create+0x37
      !QtWebEngineCore::initialize+0x15b
      !qAddPreRoutine+0x57
      !initterm+0x2d
      !TargetNtUnmapViewOfSection+0x21d6fba
      !TargetNtUnmapViewOfSection+0x21d7130
      !RtlActivateActivationContextUnsafeFast+0x12f
      !RtlEnumerateEntryHashTable+0x3bd
      !RtlEnumerateEntryHashTable+0x16e
      !RtlEnumerateEntryHashTable+0x1e0
      !RtlCopyUnicodeString+0x50d
      !RtlImageRvaToSection+0x250
      !RtlUnicodeToCustomCPN+0x3fc
      !LdrLoadDll+0xfa
      !LoadLibraryExW+0x172
      !QLibrary::unload+0x22af
      !QLibrary::load+0xa5
      !QLibrary::loadHints+0x6c
      !QPluginLoader::load+0x55
      !QUiLoader::tr+0x1df09
      !QUiLoader::QUiLoader+0x46f
      0x0000000000000000
      !PyInit_QtUiTools+0x1896
      !PyObject_MakeTpCall+0x1bc
      !PyObject_Vectorcall+0x28f
      !PyEval_EvalFrameDefault+0x79b
      !PyMapping_Check+0x1eb
      !PyEval_EvalCode+0x97
      !Py_SourceAsString+0x3dc
      !Py_SourceAsString+0x2ac
      !PyUnicode_RichCompare+0x1ef0
      !PyObject_Vectorcall+0x5e7
      !PyEval_EvalFrameDefault+0x79b
      !PyDict_MergeFromSeq2+0x3d3
      !PyLong_AsUnsignedLongMask+0x145
      !PyEval_EvalFrameDefault+0x3d4a
      !PyDict_MergeFromSeq2+0x3d3
      !PyLong_AsUnsignedLongMask+0x145
      !PyEval_EvalFrameDefault+0x3d4a
      !PyDict_MergeFromSeq2+0x3d3
      !PyErr_GivenExceptionMatches+0x18b
      !PyLong_AsDouble+0x1583
      !PyObject_Vectorcall+0x5e7
      !PyEval_EvalFrameDefault+0x79b
      !PyFunction_Vectorcall+0x1a4
      !PyFunction_Vectorcall+0x156d
      !PyObject_CallObject+0x37e
      !PyEval_EvalFrameDefault+0x5395
      !PyMapping_Check+0x1eb
      !PyEval_EvalCode+0x97
      !Py_SourceAsString+0x3dc
      !Py_SourceAsString+0x2ac
      !PyUnicode_RichCompare+0x1ef0
      !PyObject_Vectorcall+0x5e7
      !PyEval_EvalFrameDefault+0x79b
      !PyFunction_Vectorcall+0x1a4
      !PyObject_Call+0x5b
      !PyObject_GetDictPtr+0x134
      !Py_EncodeUTF8Ex+0x6f7
      !Py_RunMain+0x15
      !Py_Main+0x25
      0x0000000000000000
      !BaseThreadInitThunk+0x1d
      !RtlUserThreadStart+0x28

      And I noticed the program kept creating threads with the following stack:

      0x0000000000000000
      !NtWaitForAlertByThreadId+0x14
      !TpWorkOnBehalfClearTicket+0x2c3
      !RtlEnterCriticalSection+0x254
      !RtlEnterCriticalSection+0x42
      !RtlExitUserProcess+0x105
      !RtlQueryProcessDebugInformation+0x3bc
      !RtlQueryProcessDebugInformation+0x1fb
      !RtlQueryProcessDebugInformation+0x11e
      !RtlpQueryProcessDebugInformationRemote+0x25
      !BaseThreadInitThunk+0x1d
      !RtlUserThreadStart+0x28 

      I changed my code to the following and found all things work:

      from PySide6 import QtWidgets
      from PySide6.QtUiTools import QUiLoader
      QUiLoader()  # this goes first
      QtWidgets.QApplication([])

      I didn't see any instructions that asked me to put this call first, so I created this issue.

        1. pyside2592.py
          0.5 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            crmaurei Cristian Maureira-Fredes
            craynic yucheng cai
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes