diff options
author | J-P Nurmi <[email protected]> | 2013-10-21 14:43:19 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-10-22 13:51:33 +0200 |
commit | 4f1ed0948b99af617fa978f0f1b72e48a9fe774f (patch) | |
tree | ca86faa0d50098b4b527519af691c38654fbe77d /src | |
parent | bf245797a7b14d8c40cd9f2a12620690ef20094e (diff) |
Avoid crash when a QML signal is connected to a non-void slot
Don't pass a QVariant pointer for the return value when we're
not interested in it and the return type might not even be a
QVariant (that would be only true for QML methods).
Task-number: QTBUG-32801
Change-Id: I8f14e40d8f94caef7e3d086b776735f0484dbf0e
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 3bca862bb7..1fd47c7c66 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1436,14 +1436,15 @@ void *CallArgument::dataPtr() { if (type == -1) return qvariantPtr->data(); - else + else if (type != 0) return (void *)&allocData; + return 0; } void CallArgument::initAsType(int callType) { if (type != 0) { cleanup(); type = 0; } - if (callType == QMetaType::UnknownType) return; + if (callType == QMetaType::UnknownType || callType == QMetaType::Void) return; if (callType == qMetaTypeId<QJSValue>()) { qjsValuePtr = new (&allocData) QJSValue(); @@ -1478,9 +1479,6 @@ void CallArgument::initAsType(int callType) } else if (callType == QMetaType::QJsonValue) { type = callType; jsonValuePtr = new (&allocData) QJsonValue(); - } else if (callType == QMetaType::Void) { - type = -1; - qvariantPtr = new (&allocData) QVariant(); } else { type = -1; qvariantPtr = new (&allocData) QVariant(callType, (void *)0); |