aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-08-27 15:12:15 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-08-27 16:02:26 +0000
commit2c41d10a6a1f6fb7b496fc8c4c59e377b819f634 (patch)
treec99d68c2e3f6ca1d0dbe56735bbafe12096e144b
parent87e07fad6063736b46f19573e0af5f0fdf85cba9 (diff)
Fix crash when constructing a QApplication in an embedded application
The check code itself crashed when qApp_last == nullptr. Pick-to: 6.1 5.15 Fixes: PYSIDE-1647 Change-Id: Id8839bf551ad63f6ef2a1a997dabf455d3588c11 Reviewed-by: Christian Tismer <tismer@stackless.com>
-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 c75551c1f..809f4c25d 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);