diff options
Diffstat (limited to 'sources/pyside6/libpyside')
| -rw-r--r-- | sources/pyside6/libpyside/feature_select.cpp | 10 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/feature_select.h | 1 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pyside.cpp | 5 |
3 files changed, 15 insertions, 1 deletions
diff --git a/sources/pyside6/libpyside/feature_select.cpp b/sources/pyside6/libpyside/feature_select.cpp index 47a7472e1..b87751271 100644 --- a/sources/pyside6/libpyside/feature_select.cpp +++ b/sources/pyside6/libpyside/feature_select.cpp @@ -451,11 +451,11 @@ void finalize() } static bool patch_property_impl(); +static bool is_initialized = false; void init() { // This function can be called multiple times. - static bool is_initialized = false; if (!is_initialized) { fast_id_array = &_fast_id_array[1]; for (int idx = -1; idx < 256; ++idx) @@ -472,6 +472,14 @@ void init() cached_globals = nullptr; } +void Enable(bool enable) +{ + if (!is_initialized) + return; + featurePointer = enable ? featureProcArray : nullptr; + initSelectableFeature(enable ? SelectFeatureSet : nullptr); +} + ////////////////////////////////////////////////////////////////////////////// // // PYSIDE-1019: Support switchable extensions diff --git a/sources/pyside6/libpyside/feature_select.h b/sources/pyside6/libpyside/feature_select.h index 845828a4c..c7c14df3c 100644 --- a/sources/pyside6/libpyside/feature_select.h +++ b/sources/pyside6/libpyside/feature_select.h @@ -49,6 +49,7 @@ namespace Feature { PYSIDE_API void init(); PYSIDE_API void Select(PyObject *obj); PYSIDE_API PyObject *Select(PyTypeObject *type); +PYSIDE_API void Enable(bool); } // namespace Feature } // namespace PySide diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index 7cc17f0c6..75b3eb16f 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -50,6 +50,7 @@ #include "pysidemetafunction_p.h" #include "pysidemetafunction.h" #include "dynamicqmetaobject.h" +#include "feature_select.h" #include <autodecref.h> #include <basewrapper.h> @@ -285,7 +286,11 @@ void initQObjectSubType(SbkObjectType *type, PyObject *args, PyObject * /* kwds qWarning("Sub class of QObject not inheriting QObject!? Crash will happen when using %s.", className.constData()); return; } + // PYSIDE-1463: Don't change feature selection durin subtype initialization. + // This behavior is observed with PySide 6. + PySide::Feature::Enable(false); initDynamicMetaObject(type, userData->mo.update(), userData->cppObjSize); + PySide::Feature::Enable(true); } void initQApp() |
