aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-05-31 15:42:09 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:24 -0300
commitedf01fb44b94254eb22959f1b25f8138aa535713 (patch)
tree294b0fab786bb70dae4738c76d5f2ee90dacbe75 /generator
parenta2dac99260317da72265cc2a69b97a4353eda791 (diff)
Updated generator to use removeReference function.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'generator')
-rw-r--r--generator/cppgenerator.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index d4648b371..0875078e4 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -2344,13 +2344,18 @@ void CppGenerator::writeMethodCall(QTextStream& s, const AbstractMetaFunction* f
}
}
- s << INDENT << "Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(self), \"";
+ if (refCount.action == ReferenceCount::Add || refCount.action == ReferenceCount::Set)
+ s << INDENT << "Shiboken::Object::keepReference(";
+ else
+ s << INDENT << "Shiboken::Object::removeReference(";
+
+ s << "reinterpret_cast<SbkObject*>(self), \"";
QString varName = arg_mod.referenceCounts.first().varName;
if (varName.isEmpty())
varName = func->minimalSignature() + QString().number(arg_mod.index);
- s << varName << "\", " << pyArgName << ", "
- << (refCount.action == ReferenceCount::Add ? "true" : "false")
+ s << varName << "\", " << pyArgName
+ << (refCount.action == ReferenceCount::Add ? ", true" : "")
<< ");" << endl;
if (arg_mod.index == 0)