Fix a PythonQt bug where it would incorrectly report an error trying to convert the return value of a void slot().

This commit is contained in:
David Sansome 2011-05-22 14:10:38 +00:00
parent 58b8af4d4a
commit 2dbf6a4871
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,21 @@
diff --git a/3rdparty/pythonqt/src/PythonQtSlot.cpp b/3rdparty/pythonqt/src/PythonQtSlot.cpp
index 96f8e8d..43583be 100644
--- a/3rdparty/pythonqt/src/PythonQtSlot.cpp
+++ b/3rdparty/pythonqt/src/PythonQtSlot.cpp
@@ -159,6 +159,7 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
QString e = QString("Called ") + info->fullSignature() + ", return type '" + returnValueParam.name + "' is ignored because it is unknown to PythonQt. Probably you should register it using qRegisterMetaType() or add a default constructor decorator to the class.";
PyErr_SetString(PyExc_ValueError, e.toLatin1().data());
result = NULL;
+ ok = false;
}
}
recursiveEntry--;
@@ -170,7 +171,7 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
*pythonReturnValue = result;
// NOTE: it is important to only return here, otherwise the stack will not be popped!!!
- return result || (directReturnValuePointer && *directReturnValuePointer);
+ return ok;
}
//-----------------------------------------------------------------------------------

View File

@ -159,6 +159,7 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
QString e = QString("Called ") + info->fullSignature() + ", return type '" + returnValueParam.name + "' is ignored because it is unknown to PythonQt. Probably you should register it using qRegisterMetaType() or add a default constructor decorator to the class.";
PyErr_SetString(PyExc_ValueError, e.toLatin1().data());
result = NULL;
ok = false;
}
}
recursiveEntry--;
@ -170,7 +171,7 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
*pythonReturnValue = result;
// NOTE: it is important to only return here, otherwise the stack will not be popped!!!
return result || (directReturnValuePointer && *directReturnValuePointer);
return ok;
}
//-----------------------------------------------------------------------------------