diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-03-22 09:28:28 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-03-22 16:08:15 +0000 |
commit | fe29625e6ee1167b02612b3e4c3d5fa9ad7a3295 (patch) | |
tree | fecf01f3986e3641c3f90c5ac6e7df36e5ca7a93 | |
parent | b4ac76ea49cb827d89d5048d821ddaf9bae343f3 (diff) |
shiboken6: Fix crash when using enumeration types from other classes
qtbase/969337bcfd6af6d91b988e4b412703274a0b5877
changed QHostAddress to use enum values from QAbstractSocket which
appear as fields. This caused a crash in the module initialization
since QAbstractSocket was not initialized when creating the field
entries. Consider this in the dependency calculation.
Change-Id: Ie07dd39a373695cd604d0ebcf233be34a004c8bc
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit 2ac1870053370e017567ae53e62cd1155a01c88f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp index a7f9bb93b..755af5ebc 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp @@ -3059,8 +3059,11 @@ AbstractMetaClassList AbstractMetaBuilderPrivate::classesTopologicalSorted(const } // Member fields need to be initialized for (const AbstractMetaField &field : clazz->fields()) { - addClassDependency(classList, field.type().typeEntry(), - clazz, &graph); + auto typeEntry = field.type().typeEntry(); + if (typeEntry->isEnum()) // Enum defined in class? + typeEntry = typeEntry->parent(); + if (typeEntry != nullptr) + addClassDependency(classList, typeEntry, clazz, &graph); } } |