aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-13 10:30:35 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-13 11:02:12 +0000
commit817652ee47bb2fc68734f8ef13417d4546978a42 (patch)
tree0cdabb0492dfb65bf4e81e786586de1ea89e4705 /sources/shiboken2
parenta80ae396c4e497a64c3fed57a9c4628436ad40a4 (diff)
shiboken: Remove global-static hashes used for members of TypeEntry
TypeEntry::customConversion and ComplexTypeEntry::defaultConstructor where previously stored in global-static hashes, apparently due to BC issues. This can now be fixed. Task-number: PYSIDE-725 Task-number: PYSIDE-743 Change-Id: If4f28246a5b83e3772021a518058a9d152bb3e3f Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2')
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp36
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h2
2 files changed, 11 insertions, 27 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 93199d5dc..511b67ec8 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -2174,24 +2174,17 @@ QString ComplexTypeEntry::targetLangName() const
TypeEntry::targetLangName() : m_targetLangName;
}
-// The things we do not to break the ABI...
-typedef QHash<const ComplexTypeEntry*, QString> ComplexTypeEntryDefaultConstructorMap;
-Q_GLOBAL_STATIC(ComplexTypeEntryDefaultConstructorMap, complexTypeEntryDefaultConstructors);
-
void ComplexTypeEntry::setDefaultConstructor(const QString& defaultConstructor)
{
- if (!defaultConstructor.isEmpty())
- complexTypeEntryDefaultConstructors()->insert(this, defaultConstructor);
+ m_defaultConstructor = defaultConstructor;
}
QString ComplexTypeEntry::defaultConstructor() const
{
- if (!complexTypeEntryDefaultConstructors()->contains(this))
- return QString();
- return complexTypeEntryDefaultConstructors()->value(this);
+ return m_defaultConstructor;
}
bool ComplexTypeEntry::hasDefaultConstructor() const
{
- return complexTypeEntryDefaultConstructors()->contains(this);
+ return !m_defaultConstructor.isEmpty();
}
QString ContainerTypeEntry::targetLangName() const
@@ -2608,10 +2601,6 @@ bool TypeEntry::isCppPrimitive() const
return typeName.contains(QLatin1Char(' ')) || primitiveCppTypes().contains(typeName);
}
-// Again, stuff to avoid ABI breakage.
-typedef QHash<const TypeEntry*, CustomConversion*> TypeEntryCustomConversionMap;
-Q_GLOBAL_STATIC(TypeEntryCustomConversionMap, typeEntryCustomConversionMap);
-
TypeEntry::TypeEntry(const QString &name, TypeEntry::Type t, const QVersionNumber &vr) :
m_name(name),
m_type(t),
@@ -2621,29 +2610,22 @@ TypeEntry::TypeEntry(const QString &name, TypeEntry::Type t, const QVersionNumbe
TypeEntry::~TypeEntry()
{
- if (typeEntryCustomConversionMap()->contains(this)) {
- CustomConversion* customConversion = typeEntryCustomConversionMap()->value(this);
- typeEntryCustomConversionMap()->remove(this);
- delete customConversion;
- }
+ delete m_customConversion;
}
bool TypeEntry::hasCustomConversion() const
{
- return typeEntryCustomConversionMap()->contains(this);
+ return m_customConversion != nullptr;
}
+
void TypeEntry::setCustomConversion(CustomConversion* customConversion)
{
- if (customConversion)
- typeEntryCustomConversionMap()->insert(this, customConversion);
- else if (typeEntryCustomConversionMap()->contains(this))
- typeEntryCustomConversionMap()->remove(this);
+ m_customConversion = customConversion;
}
+
CustomConversion* TypeEntry::customConversion() const
{
- if (typeEntryCustomConversionMap()->contains(this))
- return typeEntryCustomConversionMap()->value(this);
- return 0;
+ return m_customConversion;
}
TypeSystemTypeEntry::TypeSystemTypeEntry(const QString &name, const QVersionNumber &vr) :
diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index e344e07b4..4b937faa6 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -903,6 +903,7 @@ private:
QString m_conversionRule;
bool m_stream = false;
QVersionNumber m_version;
+ CustomConversion *m_customConversion = nullptr;
};
class TypeSystemTypeEntry : public TypeEntry
@@ -1391,6 +1392,7 @@ private:
AddedFunctionList m_addedFunctions;
FunctionModificationList m_functionMods;
FieldModificationList m_fieldMods;
+ QString m_defaultConstructor;
QString m_defaultSuperclass;
QString m_qualifiedCppName;
QString m_targetLangName;