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

Crash if more than one QApplication constructed in C++ integrated PySide2 application

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.15.2
    • Shiboken
    • None
    • All
    • 2c41d10a6a1f6fb7b496fc8c4c59e377b819f634 (pyside/pyside-setup/6.2) 7e198983b4768a547b2cd30e410bccb53368b842 (pyside/tqtc-pyside-setup/5.15.7)

    Description

      With a C++ Qt application that integrates a python interpreter (Autodesk Maya in this case), if a QApplication is constructed within Python code, the application will crash with the following stack trace:

      Stack trace:

        4   libshiboken2.cpython-37m-darwin.5.15.dylib 0x0000000140f9a18b MakeQAppWrapper + 43
        5   libshiboken2.cpython-37m-darwin.5.15.dylib 0x0000000140f7e625 SbkQAppTpNew + 21
        6   Python                              0x00000001209110f2 type_call + 50
        7   Python                              0x00000001208c5db1 _PyObject_FastCallKeywords + 433
        8   Python                              0x0000000120985e84 call_function + 420
        9   Python                              0x000000012098302e _PyEval_EvalFrameDefault + 25342
        10  Python                              0x0000000120986b13 _PyEval_EvalCodeWithName + 2467
        11  Python                              0x000000012097cc54 PyEval_EvalCode + 100
        12  libCommandEngine.dylib              0x000000011729d393 TpythonInterpreter::executeCommand(Tstring const&, bool, bool, TinterpreterResult*) + 707
        13  libExtensionLayer.dylib             0x0000000116b26cdf QmayaCommandScrollField::createMimeDataFromSelection() const + 58639
        14  libExtensionLayer.dylib             0x0000000116aaf3f2 TidleAction::preDoIdleAction(Tevent const&) + 18
        15  libExtensionLayer.dylib             0x0000000116aaf317 TidleDeviceHandlerAction::serverDeleted(TclientServer*, TserverMsg const&) + 311
        16  libExtensionLayer.dylib             0x0000000116ac77ee TeventHandler::setInterrupt() + 670
        17  libExtensionLayer.dylib             0x0000000116ac666a TeventHandler::doIdles() + 458
        18  libExtensionLayer.dylib             0x0000000116ac6373 TidleTrigger::removeClientHook(Tclient*, Tmetaclass*) + 3555
        19  libQt5Core.5.dylib                  0x000000011941e48f QObject::event(QEvent*) + 111
        20  libQt5Widgets.5.dylib               0x0000000117b80f6a QApplicationPrivate::notify_helper(QObject*, QEvent*) + 266
        21  libQt5Widgets.5.dylib               0x0000000117b82391 QApplication::notify(QObject*, QEvent*) + 497
        22  libExtensionLayer.dylib             0x0000000116ab64b3 QmayaApplication::currentMousePos() + 771
        23  libQt5Core.5.dylib                  0x00000001193f3664 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 212
        24  libQt5Core.5.dylib                  0x0000000119458f8f QTimerInfoList::activateTimers() + 991
        25  libqcocoa.dylib                     0x0000000134bdd912 QCocoaEventDispatcherPrivate::activateTimersSourceCallback(void*) + 18
        26  CoreFoundation                      0x00007fff4faf5d31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
      

      In an earlier release of Autodesk Maya, integrating an earlier release of PySide2, I believe 5.12*, this returned similar to what you get when a second QApplication is constructed, if both are constructed from Python:

      # Error: RuntimeError: file <maya console> line 4: Please destroy the QApplication singleton before creating a new QApplication instance. # 
      

      Is there a means of detecting when an existing QApplication exists that is constructed from C++, and to issue the same RuntimeError exception that is issued if two QApplication instances is constructed both from Python?

      • I will confirm this.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            kkyzivat Keith Kyzivat
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes