aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-10-05 10:45:25 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:07:20 -0300
commite614afda62ea19669667164cea11742396e02169 (patch)
tree43fd9ee23f4156d11544c9dad16f9274db2bd60d /generator
parenta09cc0c3c0360ba5eb32079e95e6c00970a0ea34 (diff)
Fix bug#402 - "Exceptions raised in event methods aren't printed to console until termination"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'generator')
-rw-r--r--generator/cppgenerator.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 3e4f85658..dd64dc0a6 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -618,21 +618,23 @@ void CppGenerator::writeVirtualMethodNative(QTextStream &s, const AbstractMetaFu
if (!injectedCodeCallsPythonOverride(func)) {
s << INDENT;
s << "Shiboken::AutoDecRef " PYTHON_RETURN_VAR "(PyObject_Call(py_override, pyargs, NULL));" << endl;
+
+ s << INDENT << "// An error happened in python code!" << endl;
+ s << INDENT << "if (" PYTHON_RETURN_VAR ".isNull()) {" << endl;
+ {
+ Indentation indent(INDENT);
+ s << INDENT << "PyErr_Print();" << endl;
+ s << INDENT << "return ";
+ if (type)
+ writeMinimalConstructorCallArguments(s, func->type());
+ s << ';' << endl;
+ }
+ s << INDENT << '}' << endl;
+
if (type) {
if (invalidateReturn)
s << INDENT << "bool invalidadeArg0 = " PYTHON_RETURN_VAR "->ob_refcnt == 1;" << endl;
- s << INDENT << "// An error happened in python code!" << endl;
- s << INDENT << "if (" PYTHON_RETURN_VAR ".isNull()) {" << endl;
- {
- Indentation indent(INDENT);
- s << INDENT << "PyErr_Print();" << endl;
- s << INDENT << "return ";
- writeMinimalConstructorCallArguments(s, func->type());
- s << ';' << endl;
- }
- s << INDENT << '}' << endl;
-
if (func->type()) {
s << INDENT << "// Check return type" << endl;
s << INDENT << "bool typeIsValid = ";