From 817652ee47bb2fc68734f8ef13417d4546978a42 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 13 Jul 2018 10:30:35 +0200 Subject: 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 --- sources/shiboken2/ApiExtractor/typesystem.cpp | 36 +++++++-------------------- 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'sources/shiboken2/ApiExtractor/typesystem.cpp') 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 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 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) : -- cgit v1.2.3