aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/v4
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2012-05-11 14:13:47 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-11 17:23:20 +0200
commit5570040771ec610583473e2d9e8e069474364cf1 (patch)
treecb3b406776731996783cdcab3704a2338b944b11 /src/qml/qml/v4
parent125f4ceb393886015574a3c3fd0fc264a4f2deb6 (diff)
Permit signals to be emitted in a different thread
The QQmlNotifier approach to connecting to signals did not support the cross-thread signal/slot model used elsewhere in Qt. This change allows one specific case of that - emitting a signal in a different thread than the one the QObject lives - to work. Task-number: QTBUG-25647 Change-Id: Ia8fdaf4c7d7e2ccd7ff7657bb1d8e26277eb60aa Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/qml/qml/v4')
-rw-r--r--src/qml/qml/v4/qv4bindings.cpp8
-rw-r--r--src/qml/qml/v4/qv4bindings_p.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp
index e19d74370c..896bf21538 100644
--- a/src/qml/qml/v4/qv4bindings.cpp
+++ b/src/qml/qml/v4/qv4bindings.cpp
@@ -443,7 +443,7 @@ void QV4Bindings::subscribeId(QQmlContextData *p, int idIndex, int subIndex)
}
}
-void QV4Bindings::subscribe(QObject *o, int notifyIndex, int subIndex)
+void QV4Bindings::subscribe(QObject *o, int notifyIndex, int subIndex, QQmlEngine *e)
{
Subscription *sub = (subscriptions + subIndex);
if (sub->isConnected(o, notifyIndex))
@@ -451,7 +451,7 @@ void QV4Bindings::subscribe(QObject *o, int notifyIndex, int subIndex)
sub->bindings = this;
sub->method = subIndex;
if (o)
- sub->connect(o, notifyIndex);
+ sub->connect(o, notifyIndex, e);
else
sub->disconnect();
}
@@ -801,7 +801,7 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks,
QObject *o = 0;
const Register &object = registers[instr->subscribeop.reg];
if (!object.isUndefined()) o = object.getQObject();
- subscribe(o, instr->subscribeop.index, instr->subscribeop.offset);
+ subscribe(o, instr->subscribeop.index, instr->subscribeop.offset, context->engine);
}
QML_V4_END_INSTR(Subscribe, subscribeop)
@@ -843,7 +843,7 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks,
accessors->notifier(object, instr->fetchAndSubscribe.property.accessorData, &notifier);
if (notifier) sub->connect(notifier);
} else if (instr->fetchAndSubscribe.property.notifyIndex != -1) {
- sub->connect(object, instr->fetchAndSubscribe.property.notifyIndex);
+ sub->connect(object, instr->fetchAndSubscribe.property.notifyIndex, context->engine);
}
}
}
diff --git a/src/qml/qml/v4/qv4bindings_p.h b/src/qml/qml/v4/qv4bindings_p.h
index 8ceccbb731..cb483d1f95 100644
--- a/src/qml/qml/v4/qv4bindings_p.h
+++ b/src/qml/qml/v4/qv4bindings_p.h
@@ -146,7 +146,7 @@ private:
inline void unsubscribe(int subIndex);
inline void subscribeId(QQmlContextData *p, int idIndex, int subIndex);
- inline void subscribe(QObject *o, int notifyIndex, int subIndex);
+ inline void subscribe(QObject *o, int notifyIndex, int subIndex, QQmlEngine *);
inline static qint32 toInt32(double n);
static const double D32;