From 475d5266e41a5d95a73478dd770d6a8326a95021 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Sun, 21 May 2023 22:52:47 +0300 Subject: [PATCH] Moc: prevent potential unnecessary detach Change Generator::generateSignal() to take by const FunctionDef*, so that it can be called with the return of QList::at(). Change-Id: I5ffb0726a5ded6561e0000a2bea1973ada675152 Reviewed-by: Fabian Kosmale Reviewed-by: Thiago Macieira --- src/tools/moc/generator.cpp | 4 ++-- src/tools/moc/generator.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index f295235c1c..75f1ce00ff 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -627,7 +627,7 @@ void Generator::generateCode() // Generate internal signal functions // for (int signalindex = 0; signalindex < int(cdef->signalList.size()); ++signalindex) - generateSignal(&cdef->signalList[signalindex], signalindex); + generateSignal(&cdef->signalList.at(signalindex), signalindex); // // Generate plugin meta data @@ -1408,7 +1408,7 @@ void Generator::generateStaticMetacall() fprintf(out, "}\n"); } -void Generator::generateSignal(FunctionDef *def,int index) +void Generator::generateSignal(const FunctionDef *def, int index) { if (def->wasCloned || def->isAbstract) return; diff --git a/src/tools/moc/generator.h b/src/tools/moc/generator.h index 91f8e00d61..2d4d69ca05 100644 --- a/src/tools/moc/generator.h +++ b/src/tools/moc/generator.h @@ -40,7 +40,7 @@ private: void generateProperties(); void generateMetacall(); void generateStaticMetacall(); - void generateSignal(FunctionDef *def, int index); + void generateSignal(const FunctionDef *def, int index); void generatePluginMetaData(); QMultiMap automaticPropertyMetaTypesHelper(); QMap>