diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-12-17 11:00:24 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:12:49 -0300 |
commit | 62d4437e2d0df7a0706b564519e8fb26303f1e9a (patch) | |
tree | 7eca719d02ae573cc72d3a80f0182824f8627c3e /generator/cppgenerator.cpp | |
parent | a3e731a9ea920ec6e1373e6ad6c74724ce36575f (diff) |
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.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index 8158fe156..f1e900f36 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; } } } |