aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-12-18 11:25:33 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-01-08 17:14:27 +0100
commitadf2ecfdc9ee9dc928fedb580de2d55129a8559e (patch)
tree2bf759403ff746b20a97287b0cf4056a6bd89daa
parent94956c5e176a9bb0ff36ecf51e925f7725800d35 (diff)
shiboken6: Fix support of multiple smart pointer types
The function searching for the instantiations of smart pointers was not checking for the smart pointer type entry, so, QSharedPointer<int> was hiding std::shared_ptr<int>. Check for the type entry as well. Rearrange the code a bit. Task-numnber: PYSIDE-454 Change-Id: Ib7a0385ce2c0f8de84b644168b0164f13f3332ad Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 069f7309d72b2a1f80638641ac3d6269b6aefc1d)
-rw-r--r--sources/shiboken2/generator/generator.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp
index dd56ab7cd..f90cd312f 100644
--- a/sources/shiboken2/generator/generator.cpp
+++ b/sources/shiboken2/generator/generator.cpp
@@ -276,24 +276,24 @@ void Generator::addInstantiatedContainersAndSmartPointers(const AbstractMetaType
return;
}
- QString typeName = getSimplifiedContainerTypeName(type);
if (isContainer) {
+ QString typeName = getSimplifiedContainerTypeName(type);
if (!m_d->instantiatedContainersNames.contains(typeName)) {
m_d->instantiatedContainersNames.append(typeName);
m_d->instantiatedContainers.append(type);
}
- } else {
- // Is smart pointer. Check if the (const?) pointee is already known
- auto pt = pointeeTypeEntry(type);
- const bool present =
- std::any_of(m_d->instantiatedSmartPointers.cbegin(), m_d->instantiatedSmartPointers.cend(),
- [pt] (const AbstractMetaType *t) {
- return pointeeTypeEntry(t) == pt;
- });
- if (!present)
- m_d->instantiatedSmartPointers.append(canonicalSmartPtrInstantiation(type));
+ return;
}
-
+ // Is smart pointer. Check if the (const?) pointee is already known for the given
+ // smart pointer type entry.
+ auto pt = pointeeTypeEntry(type);
+ const bool present =
+ std::any_of(m_d->instantiatedSmartPointers.cbegin(), m_d->instantiatedSmartPointers.cend(),
+ [typeEntry, pt] (const AbstractMetaType *t) {
+ return t->typeEntry() == typeEntry && pointeeTypeEntry(t) == pt;
+ });
+ if (!present)
+ m_d->instantiatedSmartPointers.append(canonicalSmartPtrInstantiation(type));
}
void Generator::collectInstantiatedContainersAndSmartPointers(const AbstractMetaFunction *func)