aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-07-02 15:37:05 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-07-02 15:37:05 +0200
commita883b9301cc189b40ceb5bcfbb75f98aab1b1778 (patch)
tree20f8d392314430010bcb1f34a2ca227b5bd497ea /sources/shiboken2
parentb2b5c8c274afaccbaef4437da8932364b9f07dbf (diff)
parent423f12bb6908667e34a477ccf515a2377fc7a596 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'sources/shiboken2')
-rw-r--r--sources/shiboken2/libshiboken/qapp_macro.cpp12
1 files 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();
+ }
}
}