aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-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();
+ }
}
}