diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-11-27 17:11:47 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-11-30 15:53:54 +0000 |
| commit | 30cdcd7b8e7f70bf6b64450ca622dd4494e3a0ea (patch) | |
| tree | 044002feaeb24281e9000648a1342073701ee29c /sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp | |
| parent | f4fd97655f20e2ce4d24704056b7a7a9ab9db355 (diff) | |
shiboken6: Store AbstractMetaFunction using a QSharedPointer
Store the list functions (global / class member) as a
QList<QSharedPointer<const AbstractMetaFunction> instead of a raw
pointer list. This makes passing around function lists easier and
solves the memory leaks caused by mixing cloned and unmodified
functions while collecting the overload lists in the generators.
- Change the function signatures accordingly
- Add a qSharedPointerConstCast() for non-const access.
- Restructure the traversing of added functions
in the AbstractMetaBuilder
- Remove some unused typedefs and functions unearthed by
the change
Change-Id: I08a6c5243750e3eb3813bc3f7172899ad2b13e22
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp')
| -rw-r--r-- | sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp b/sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp index d39819d0f..6d155dacc 100644 --- a/sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp @@ -45,7 +45,8 @@ void TestVoidArg::testVoidParsedFunction() AbstractMetaClassList classes = builder->classes(); const AbstractMetaClass *classA = AbstractMetaClass::findClass(classes, QLatin1String("A")); QVERIFY(classA); - const AbstractMetaFunction* addedFunc = classA->findFunction(QLatin1String("a")); + const auto addedFunc = classA->findFunction(QLatin1String("a")); + QVERIFY(!addedFunc.isNull()); QCOMPARE(addedFunc->arguments().count(), 0); } @@ -63,7 +64,8 @@ void TestVoidArg::testVoidAddedFunction() AbstractMetaClassList classes = builder->classes(); const AbstractMetaClass *classA = AbstractMetaClass::findClass(classes, QLatin1String("A")); QVERIFY(classA); - const AbstractMetaFunction* addedFunc = classA->findFunction(QLatin1String("a")); + const auto addedFunc = classA->findFunction(QLatin1String("a")); + QVERIFY(!addedFunc.isNull()); QCOMPARE(addedFunc->arguments().count(), 0); } @@ -80,7 +82,8 @@ void TestVoidArg::testVoidPointerParsedFunction() AbstractMetaClassList classes = builder->classes(); const AbstractMetaClass *classA = AbstractMetaClass::findClass(classes, QLatin1String("A")); QVERIFY(classA); - const AbstractMetaFunction* addedFunc = classA->findFunction(QLatin1String("a")); + const auto addedFunc = classA->findFunction(QLatin1String("a")); + QVERIFY(!addedFunc.isNull()); QCOMPARE(addedFunc->arguments().count(), 1); } |
