summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-04-29 11:10:23 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-04-29 14:12:56 -0300
commitfa4b91e8de101ffb63dcfee6ae95a36e5755fb77 (patch)
tree31c8befcba370dabeaef9dcc1c41c28849473d45
parent55e4336840093a118da89602b43b91f36a115344 (diff)
downloadshiboken-fa4b91e8de101ffb63dcfee6ae95a36e5755fb77.tar.gz
shiboken-fa4b91e8de101ffb63dcfee6ae95a36e5755fb77.tar.xz
shiboken-fa4b91e8de101ffb63dcfee6ae95a36e5755fb77.zip
Fixed refcount leak on virtual functions args.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--shibokengenerator.cpp9
-rw-r--r--shibokengenerator.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp
index 33c5ad65..7032afdd 100644
--- a/shibokengenerator.cpp
+++ b/shibokengenerator.cpp
@@ -368,15 +368,16 @@ void ShibokenGenerator::writeToCppConversion(QTextStream& s, const AbstractMetaT
s << "toCpp(" << argumentName << ')';
}
-QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func) const
+QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func, bool incRef) const
{
QString result;
+ const char objType = (incRef ? 'O' : 'S');
foreach (const AbstractMetaArgument* arg, func->arguments()) {
if (func->argumentRemoved(arg->argumentIndex() + 1))
continue;
if (!func->typeReplaced(arg->argumentIndex() + 1).isEmpty()) {
- result += 'O';
+ result += objType;
} else if (arg->type()->isQObject()
|| arg->type()->isObject()
|| arg->type()->isValue()
@@ -384,7 +385,7 @@ QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func)
|| arg->type()->isEnum()
|| arg->type()->isFlags()
|| arg->type()->isReference()) {
- result += 'O';
+ result += objType;
} else if (arg->type()->isPrimitive()) {
const PrimitiveTypeEntry* ptype = (const PrimitiveTypeEntry*) arg->type()->typeEntry();
if (ptype->basicAliasedTypeEntry())
@@ -392,7 +393,7 @@ QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func)
if (m_formatUnits.contains(ptype->name()))
result += m_formatUnits[ptype->name()];
else
- result += 'O';
+ result += objType;
} else if (isCString(arg->type())) {
result += 'z';
} else {
diff --git a/shibokengenerator.h b/shibokengenerator.h
index 7c8a5d39..288acc87 100644
--- a/shibokengenerator.h
+++ b/shibokengenerator.h
@@ -278,7 +278,7 @@ public:
QString cpythonSpecialCastFunctionName(const AbstractMetaClass* metaClass);
QString getFunctionReturnType(const AbstractMetaFunction* func, Options options = NoOption) const;
- QString getFormatUnitString(const AbstractMetaFunction* func) const;
+ QString getFormatUnitString(const AbstractMetaFunction* func, bool incRef = false) const;
/// Returns the name of the macro used to export symbols
QString getApiExportMacro() const;