diff options
author | Christian Tismer <tismer@stackless.com> | 2020-07-16 12:49:17 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2020-07-16 14:18:20 +0200 |
commit | e2fbf1ab26e1c763c556bd592dbf34a39ab84eaa (patch) | |
tree | 1178e85f8c5818c507f0918e5a4b57fea01cf90c | |
parent | c101fbd6cdadab34653a36fbe7c122db47f9ddb0 (diff) |
feature-select: fix crash in scriptable application
The feature selection framework had a very early static
initialization from the early stages of the development.
Normally, Python is initialized before PySide gets loaded.
In case of scriptable application, this might not be so.
Actually this static initialization was no longer necessary
and was removed, as the bug was hopefully as well.
Change-Id: I2c703c9cac14b6093d0c43c4bae94ff2b29c0640
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r-- | sources/pyside2/libpyside/feature_select.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/sources/pyside2/libpyside/feature_select.cpp b/sources/pyside2/libpyside/feature_select.cpp index b7234ad75..6e5670d6d 100644 --- a/sources/pyside2/libpyside/feature_select.cpp +++ b/sources/pyside2/libpyside/feature_select.cpp @@ -170,26 +170,22 @@ static void ensureNewDictType() static inline PyObject *nextInCircle(PyObject *dict) { // returns a borrowed ref - assert(Py_TYPE(dict) != old_dict_type); AutoDecRef next_dict(PyObject_GetAttr(dict, PyName::dict_ring())); return next_dict; } static inline void setNextDict(PyObject *dict, PyObject *next_dict) { - assert(Py_TYPE(dict) != old_dict_type); PyObject_SetAttr(dict, PyName::dict_ring(), next_dict); } static inline void setSelectId(PyObject *dict, PyObject *select_id) { - assert(Py_TYPE(dict) != old_dict_type); PyObject_SetAttr(dict, PyName::select_id(), select_id); } static inline PyObject *getSelectId(PyObject *dict) { - assert(Py_TYPE(dict) != old_dict_type); auto select_id = PyObject_GetAttr(dict, PyName::select_id()); return select_id; } @@ -318,7 +314,7 @@ static PyObject *SelectFeatureSet(PyTypeObject *type) * It just makes no sense to make the function public, because * Shiboken will assign it via a public hook of `basewrapper.cpp`. */ - if (Py_TYPE(type->tp_dict) == old_dict_type) { + if (Py_TYPE(type->tp_dict) == Py_TYPE(PyType_Type.tp_dict)) { // PYSIDE-1019: On first touch, we initialize the dynamic naming. // The dict type will be replaced after the first call. if (!replaceClassDict(type)) |