{
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();
} 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);
--- /dev/null
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ signal testSignal(string arg)
+
+ function emitTestSignal() {
+ testSignal("test")
+ }
+}
void qjsvalueMethod(const QJSValue &v) { m_qjsvalue = v; }
void v8function(QQmlV4Function*);
void registeredFlagMethod(Qt::MouseButtons v) { m_buttons = v; }
+ QString slotWithReturnValue(const QString &arg) { return arg; }
private:
friend class tst_qqmlecmascript;
void jsOwnedObjectsDeletedOnEngineDestroy();
void numberParsing();
void stringParsing();
+ void qtbug_32801();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
}
}
+void tst_qqmlecmascript::qtbug_32801()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_32801.qml"));
+
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(obj != 0);
+
+ // do not crash when a QML signal is connected to a non-void slot
+ connect(obj.data(), SIGNAL(testSignal(QString)), obj.data(), SLOT(slotWithReturnValue(QString)));
+ QVERIFY(QMetaObject::invokeMethod(obj.data(), "emitTestSignal"));
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"