diff --git a/0002-Fix-qApp-import-of-QCoreApplication.patch b/0002-Fix-qApp-import-of-QCoreApplication.patch new file mode 100644 index 0000000..95a35fe --- /dev/null +++ b/0002-Fix-qApp-import-of-QCoreApplication.patch @@ -0,0 +1,42 @@ +From 5376a134f13124b9b228dd160f151a7c8eccd09a Mon Sep 17 00:00:00 2001 +From: Christian Tismer +Date: Thu, 27 Jun 2019 12:37:41 +0200 +Subject: [PATCH 1/7] Fix qApp import of QCoreApplication + +The qApp fix for embedding has a recursion bug when +QCoreApplication is imported. +This patch avoids imports altogether and uses the already +captured module, instead. + +Change-Id: I1af7293a31840f6b09f8611446f6f35952dedd21 +Reviewed-by: Milian Wolff +--- + sources/shiboken2/libshiboken/qapp_macro.cpp | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/sources/shiboken2/libshiboken/qapp_macro.cpp b/sources/shiboken2/libshiboken/qapp_macro.cpp +index df24a805..12af9613 100644 +--- a/sources/shiboken2/libshiboken/qapp_macro.cpp ++++ b/sources/shiboken2/libshiboken/qapp_macro.cpp +@@ -240,11 +240,13 @@ NotifyModuleForQApp(PyObject *module, void *qApp) + * Therefore, the implementation is very simple and just redirects the + * qApp_contents variable and assigns the instance, instead of vice-versa. + */ +- if (qApp != nullptr) { +- Shiboken::AutoDecRef pycore(PyImport_ImportModule("PySide2.QtCore")); +- Shiboken::AutoDecRef coreapp(PyObject_GetAttrString(pycore, "QCoreApplication")); +- qApp_content = PyObject_CallMethod(coreapp, "instance", ""); +- reset_qApp_var(); ++ PyObject *coreDict = qApp_moduledicts[1]; ++ if (qApp != nullptr && coreDict != nullptr) { ++ PyObject *coreApp = PyDict_GetItemString(coreDict, "QCoreApplication"); ++ if (coreApp != nullptr) { ++ qApp_content = PyObject_CallMethod(coreApp, "instance", ""); ++ reset_qApp_var(); ++ } + } + } + +-- +2.22.0 + diff --git a/0003-PySide2-QtCore-Remove-duplicated-type-entry-for-bool.patch b/0003-PySide2-QtCore-Remove-duplicated-type-entry-for-bool.patch new file mode 100644 index 0000000..f6fc30b --- /dev/null +++ b/0003-PySide2-QtCore-Remove-duplicated-type-entry-for-bool.patch @@ -0,0 +1,28 @@ +From 8fa674375a3ea5609ffe8dadeb697915347a4072 Mon Sep 17 00:00:00 2001 +From: Friedemann Kleint +Date: Thu, 4 Jul 2019 15:57:00 +0200 +Subject: [PATCH 6/7] PySide2/QtCore: Remove duplicated type entry for "bool" + +Another entry with converters exists a few lines below. + +Change-Id: Id1de3835e42869a55e0bf865aa992f38748f2e88 +Reviewed-by: Christian Tismer +--- + sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +index 4f800cc9..2173e747 100644 +--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml ++++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +@@ -171,7 +171,6 @@ + + + +- + + + +-- +2.22.0 + diff --git a/python3-pyside2.changes b/python3-pyside2.changes index 3ec140d..e6edf9f 100644 --- a/python3-pyside2.changes +++ b/python3-pyside2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Jul 10 06:37:12 UTC 2019 - Tuukka Pasanen + +- Add patches to make FreeCAD not crash at start + * 0002-Fix-qApp-import-of-QCoreApplication.patch + * 0003-PySide2-QtCore-Remove-duplicated-type-entry-for-bool.patch + ------------------------------------------------------------------- Mon Jul 1 18:00:38 UTC 2019 - Stefan BrĂ¼ns diff --git a/python3-pyside2.spec b/python3-pyside2.spec index 44db1d4..5b57ed9 100644 --- a/python3-pyside2.spec +++ b/python3-pyside2.spec @@ -33,6 +33,8 @@ Source0: https://download.qt.io/official_releases/QtForPython/pyside2/PyS Patch0: lib64.patch # PATCH-FIX-UPSTREAM - PYSIDE-881 Patch1: 0001-Remove-unnecessary-she-bang-from-icon-cache.py.patch +Patch2: 0002-Fix-qApp-import-of-QCoreApplication.patch +Patch3: 0003-PySide2-QtCore-Remove-duplicated-type-entry-for-bool.patch BuildRequires: cmake BuildRequires: fdupes BuildRequires: gcc-c++ @@ -119,6 +121,8 @@ Examples and Tutorials for the PySide2 bindings for Qt. %patch0 -p1 %endif %patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build export LLVM_INSTALL_DIR=%{_prefix}