aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-05-23 11:45:34 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-05-23 15:47:57 +0000
commit3cde353830445dc81fdec5de72a7ffa9f19733c5 (patch)
tree547cd0b9b8428e2ec644b71373e007645f61f30c
parent963121d36cc3d49abd2b19246d838d701a8e5b0b (diff)
shiboken6: Indicate ownership transferences by return value heuristics
Make them easier to spot in case they cause issues. Task-number: PYSIDE-1939 Change-Id: Iecbf8a4b8945ccfc0c2f789daff116bf9df7b0a3 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit b0f4b96c4b3172578f9ea52fbf1556c553f7b8ce) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index 5dd8978e1..60f89666e 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -6842,8 +6842,10 @@ void CppGenerator::writeReturnValueHeuristics(TextStream &s, const AbstractMetaF
ArgumentOwner argOwner = getArgumentOwner(func, ArgumentOwner::ReturnIndex);
if (argOwner.action == ArgumentOwner::Invalid || argOwner.index != ArgumentOwner::ThisIndex) {
- if (type.isPointerToWrapperType())
- s << "Shiboken::Object::setParent(self, " << PYTHON_RETURN_VAR << ");\n";
+ if (type.isPointerToWrapperType()) {
+ s << "// Ownership transferences (heuristics).\n"
+ << "Shiboken::Object::setParent(self, " << PYTHON_RETURN_VAR << ");\n";
+ }
}
}