From 5376a134f13124b9b228dd160f151a7c8eccd09a Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Thu, 27 Jun 2019 12:37:41 +0200 Subject: 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 df24a8052..12af9613c 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(); + } } } -- cgit v1.2.3 From 19e316d71dce61a3aab86875f4ade3963ece1fad Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 1 Jul 2019 17:18:47 +0200 Subject: Update pyside2-tools submodule Task-number: PYSIDE-1020 Change-Id: Iab80959720e1fd98090cd7793ff31cdee1f3911c Reviewed-by: Christian Tismer --- sources/pyside2-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/pyside2-tools b/sources/pyside2-tools index 72104d1cb..bd27bac45 160000 --- a/sources/pyside2-tools +++ b/sources/pyside2-tools @@ -1 +1 @@ -Subproject commit 72104d1cb6a1ea5b3c529532f2ad7491d26a89a9 +Subproject commit bd27bac457943aab1082ac1c5b3f81ef9574c671 -- cgit v1.2.3 From 423f12bb6908667e34a477ccf515a2377fc7a596 Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Mon, 17 Jun 2019 12:51:25 +0200 Subject: Leave QVariantMap as a name, not a type The problem happened on the QtLocation module, when the QVariantMap argument was being used in several functions, and this type was declared as a primitive-type in QtCore. An approach to change the type to a container-type failed, because since QVariantMap is a typedef, is was already registered as a name associated to the definition QMap. The solution was to register the name at the beginning of the module (like QVariantList), and remove the type declaration, leaving it only as a name. Previously, the wrongly generated code looked like this: Shiboken::Conversions::PrimitiveTypeConverter() but with this patch, it looks like: SbkPySide2_QtLocationTypeConverters[SBK_QTLOCATION_QMAP_QSTRING_QVARIANT_IDX] which is the proper name established by the code on glue/qtcore.cpp: Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap"); Change-Id: Id172cf5b1e3ac784bc9497359279e81fcba1d8ec Fixes: PYSIDE-1028 Reviewed-by: Qt CI Bot Reviewed-by: Christian Tismer Reviewed-by: Friedemann Kleint --- sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | 2 -- sources/pyside2/PySide2/glue/qtcore.cpp | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 9ba45b2e5..4f800cc90 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -303,8 +303,6 @@ - - diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index cb5cb4e68..930ad9349 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -190,10 +190,6 @@ static QVariant QVariant_convertToVariantList(PyObject *list) } // @snippet qvariant-conversion -// @snippet qvariantmap-register -Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap"); -// @snippet qvariantmap-register - // @snippet qvariantmap-check static bool QVariantType_isStringList(PyObject *list) { @@ -519,6 +515,7 @@ PySide::runCleanupFunctions(); Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "unicode"); Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "str"); Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QLIST_QVARIANT_IDX], "QVariantList"); +Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap"); PySide::registerInternalQtConf(); PySide::init(module); -- cgit v1.2.3