aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-03-22 09:28:28 +0100
committerMaximilian Goldstein <max.goldstein@qt.io>2021-03-22 13:36:55 +0100
commit2ac1870053370e017567ae53e62cd1155a01c88f (patch)
tree690ff30ceebd061c6a4613eaec1be480088ed7f8 /sources
parent1c54901e4d17ce1ff7f8f56267fca95ee84c1480 (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. Pick-to: 6.0 Pick-to: 5.15 Change-Id: Ie07dd39a373695cd604d0ebcf233be34a004c8bc Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
index 73e974386..8e83a2df4 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
@@ -3067,8 +3067,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);
}
}