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

Segfault when QApplication exists before "import PySide2.QtCore"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.13.0
    • PySide
    • None
    • Debian Linux inside Docker with Qt 5.13.0 installed via the official installer. Tried PySide2 from pip and built from source.
    • Linux/X11

      When embedding Python/PySide2 into an existing Qt Application where the QtGuiApplication was created in C++ code before the "import PySide2" in python happens, the application crashes with a SIGSEGV.

      Minimal example:

      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          Py_Initialize();
          PyRun_SimpleString("from PySide2.QtCore import Slot, Qt\n");
      
      }
      

      Top of Stacktrace:

      #0  0x00007fd761ee2b90 in PyObject_GetAttrString () from /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0
      #1  0x00007fd751d67067 in NotifyModuleForQApp () from /usr/local/lib/python3.7/dist-packages/shiboken2/libshiboken2.cpython-37m-x86_64-linux-gnu.so.5.13
      #2  0x00007fd751b1e30a in PyInit_QtCore () from /usr/local/lib/python3.7/dist-packages/PySide2/QtCore.cpython-37m-x86_64-linux-gnu.so
      #3  0x00007fd761e36a93 in _PyImport_LoadDynamicModuleWithSpec () from /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0

      The backtrace is huge with PyInit_QtCore and NotifiyModuleForQApp repeated over and over again. Might we an infinite loop that results in the crash.

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

            crmaurei Cristian Maureira-Fredes
            flauer F B
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes