From 30cdcd7b8e7f70bf6b64450ca622dd4494e3a0ea Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 27 Nov 2020 17:11:47 +0100 Subject: shiboken6: Store AbstractMetaFunction using a QSharedPointer Store the list functions (global / class member) as a QList 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 --- sources/shiboken6/ApiExtractor/doxygenparser.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sources/shiboken6/ApiExtractor/doxygenparser.cpp') diff --git a/sources/shiboken6/ApiExtractor/doxygenparser.cpp b/sources/shiboken6/ApiExtractor/doxygenparser.cpp index 90afc245c..a731479c3 100644 --- a/sources/shiboken6/ApiExtractor/doxygenparser.cpp +++ b/sources/shiboken6/ApiExtractor/doxygenparser.cpp @@ -42,7 +42,7 @@ #include #include -static QString getSectionKindAttr(const AbstractMetaFunction *func) +static QString getSectionKindAttr(const AbstractMetaFunctionCPtr &func) { if (func->isSignal()) return QLatin1String("signal"); @@ -121,8 +121,8 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass) metaClass->setDocumentation(classDoc); //Functions Documentation - const AbstractMetaFunctionList &funcs = DocParser::documentableFunctions(metaClass); - for (AbstractMetaFunction *func : funcs) { + const auto &funcs = DocParser::documentableFunctions(metaClass); + for (const auto &func : funcs) { QString query = QLatin1String("/doxygen/compounddef/sectiondef"); // properties if (func->isPropertyReader() || func->isPropertyWriter() @@ -172,13 +172,13 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass) QString doc = getDocumentation(xquery, funcQuery, DocModificationList()); if (doc.isEmpty()) { qCWarning(lcShibokenDoc, "%s", - qPrintable(msgCannotFindDocumentation(doxyFilePath, metaClass, func, + qPrintable(msgCannotFindDocumentation(doxyFilePath, metaClass, func.data(), funcQuery))); } else { funcDoc.setValue(doc, tag.first); } } - func->setDocumentation(funcDoc); + qSharedPointerConstCast(func)->setDocumentation(funcDoc); isProperty = false; } -- cgit v1.2.3