break;
case Call: {
QObjectSlotDispatcher *This = static_cast<QObjectSlotDispatcher*>(this_);
+ QV4::ExecutionEngine *v4 = This->function.engine();
+ // Might be that we're still connected to a signal that's emitted long
+ // after the engine died. We don't track connections in a global list, so
+ // we need this safeguard.
+ if (!v4)
+ break;
+
QVarLengthArray<int, 9> dummy;
int *argsTypes = QQmlPropertyCache::methodParameterTypes(r, This->signalIndex, dummy, 0);
int argCount = argsTypes ? argsTypes[0]:0;
- QV4::ExecutionEngine *v4 = This->function.engine();
- Q_ASSERT(v4);
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, This->function.value());
QV4::ExecutionContext *ctx = v4->currentContext();
void include();
void includeRemoteSuccess();
void signalHandlers();
+ void qtbug_37351();
void doubleEvaluate();
void forInLoop();
void nonNotifyable();
delete o;
}
+void tst_qqmlecmascript::qtbug_37351()
+{
+ MyTypeObject signalEmitter;
+ {
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import Qt.test 1.0; import QtQml 2.0;\nQtObject {\n"
+ " Component.onCompleted: {\n"
+ " testObject.action.connect(function() { print('dont crash'); });"
+ " }\n"
+ "}", QUrl());
+
+ engine.rootContext()->setContextProperty("testObject", &signalEmitter);
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+ }
+ signalEmitter.doAction();
+ // Don't crash
+}
+
void tst_qqmlecmascript::qtbug_10696()
{
QQmlComponent component(&engine, testFileUrl("qtbug_10696.qml"));