summaryrefslogtreecommitdiffstats
path: root/generator/cppgenerator.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-12-17 11:00:24 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-12-17 11:03:07 -0300
commit81423ee9987008864cf1d66d009afc815c2419e5 (patch)
tree2d48d5077b1db2b727bfe689f6a926edb9eac78c /generator/cppgenerator.cpp
parent45d4e4b0eabc87cd50613a469ce400434b833d6d (diff)
downloadshiboken-81423ee9987008864cf1d66d009afc815c2419e5.tar.gz
shiboken-81423ee9987008864cf1d66d009afc815c2419e5.tar.xz
shiboken-81423ee9987008864cf1d66d009afc815c2419e5.zip
Fixed code generation for virtual method ownership release of returned value.
The value returned from Python to C++ shouldn't have its reference counting decremented after Python transferring ownership to C++.
Diffstat (limited to 'generator/cppgenerator.cpp')
-rw-r--r--generator/cppgenerator.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 2b5a4584..8a922729 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -794,13 +794,11 @@ void CppGenerator::writeVirtualMethodNative(QTextStream &s, const AbstractMetaFu
s << (argMod.index - 1) << "));" << endl;
} else if (argMod.ownerships.contains(TypeSystem::NativeCode)) {
if (argMod.index == 0 && argMod.ownerships[TypeSystem::NativeCode] == TypeSystem::CppOwnership) {
- s << INDENT << "if (Shiboken::Object::checkType(" PYTHON_RETURN_VAR ")) {" << endl;
+ s << INDENT << "if (Shiboken::Object::checkType(" PYTHON_RETURN_VAR "))" << endl;
{
Indentation indent(INDENT);
s << INDENT << "Shiboken::Object::releaseOwnership(" PYTHON_RETURN_VAR ");" << endl;
- s << INDENT << "Py_DECREF((PyObject*) " PYTHON_RETURN_VAR ");" << endl;
}
- s << INDENT << '}' << endl;
}
}
}