@@ -80,6 +80,8 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
80
80
const QList<PythonQtSlotInfo::ParameterInfo>& params = info->parameters ();
81
81
82
82
const PythonQtSlotInfo::ParameterInfo& returnValueParam = params.at (0 );
83
+ bool isVoidReturnValue = (returnValueParam.typeId == QMetaType::Void);
84
+
83
85
// set return argument to NULL
84
86
argList[0 ] = NULL ;
85
87
@@ -133,7 +135,7 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
133
135
}
134
136
135
137
// parameters are ok, now create the qt return value which is assigned to by metacall
136
- if (returnValueParam. typeId != QMetaType::Void ) {
138
+ if (!isVoidReturnValue ) {
137
139
// create empty default value for the return value
138
140
if (!directReturnValuePointer) {
139
141
// create empty default value for the return value
@@ -219,7 +221,7 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
219
221
220
222
// handle the return value (which in most cases still needs to be converted to a Python object)
221
223
if (!hadException) {
222
- if (argList[0 ] || returnValueParam. typeId == QMetaType::Void ) {
224
+ if (argList[0 ] || isVoidReturnValue ) {
223
225
if (directReturnValuePointer) {
224
226
result = NULL ;
225
227
} else {
@@ -232,9 +234,11 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
232
234
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." ;
233
235
PyErr_SetString (PyExc_ValueError, e.toLatin1 ().data ());
234
236
result = NULL ;
237
+ ok = false ;
235
238
}
236
239
} else {
237
240
result = NULL ;
241
+ ok = false ;
238
242
}
239
243
}
240
244
recursiveEntry--;
@@ -255,8 +259,11 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
255
259
}
256
260
// NOTE: a return value can not pass the ownership to CPP, it would not make sense...
257
261
}
262
+ // Either we have a
263
+ // a) a result value
264
+ // b) a directReturnValuePointer and it has a value or the return value is void
258
265
// NOTE: it is important to only return here, otherwise the stack will not be popped!!!
259
- return result || (directReturnValuePointer && *directReturnValuePointer);
266
+ return ok && ( result || (directReturnValuePointer && ( *directReturnValuePointer || isVoidReturnValue)) );
260
267
}
261
268
262
269
// -----------------------------------------------------------------------------------
0 commit comments