aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-08-27 15:12:15 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-27 18:28:07 +0000
commitaaba2fbd4717a7de721f7dbd0601260dc3250a2a (patch)
treeccd4be89139d13f0c5f65f2573880f3083499edb
parent0925b079e9d9d9907805584cbca80f8f9305abd8 (diff)
Fix crash when constructing a QApplication in an embedded application
The check code itself crashed when qApp_last == nullptr. Fixes: PYSIDE-1647 Change-Id: Id8839bf551ad63f6ef2a1a997dabf455d3588c11 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 2c41d10a6a1f6fb7b496fc8c4c59e377b819f634) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/libshiboken/basewrapper.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/shiboken6/libshiboken/basewrapper.cpp b/sources/shiboken6/libshiboken/basewrapper.cpp
index 51a10d100..d6935ef2a 100644
--- a/sources/shiboken6/libshiboken/basewrapper.cpp
+++ b/sources/shiboken6/libshiboken/basewrapper.cpp
@@ -437,7 +437,8 @@ PyObject *MakeQAppWrapper(PyTypeObject *type)
// protecting from multiple application instances
if (!(type == nullptr || qApp_last == Py_None)) {
- const char *res_name = PepType_GetNameStr(Py_TYPE(qApp_last));
+ const char *res_name = qApp_last != nullptr
+ ? PepType_GetNameStr(Py_TYPE(qApp_last)) : "<Unknown>";
const char *type_name = PepType_GetNameStr(type);
PyErr_Format(PyExc_RuntimeError, "Please destroy the %s singleton before"
" creating a new %s instance.", res_name, type_name);