From 37e4975e5f43a85e81109b115bfe10d371d0bf89 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 10 Apr 2014 12:58:15 +0200 Subject: Refine fix for dynamic properties on QObjects wrapped in JavaScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is an ammendment to commit 60730cbb5e5475b5db6a15641211aa6958a93197 to further restrict the ability to set dynamic properties on JS wrapped QObjects only on those that are associated with a qml context. Only one such association comes with the static property lookup rules of QML and therefore only those should be prohibited from dynamic properties. The previous implementation on using the "compiledData" field to detect QML association or not is not strong and reliable enough. Change-Id: I10c0e6e58a2727c01a6cb56fdf912bf250333e1f Reviewed-by: Jędrzej Nowacki --- src/qml/jsruntime/qv4qobjectwrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/jsruntime') diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index de556dc9ed..b61be913a6 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -685,7 +685,7 @@ void QObjectWrapper::put(Managed *m, const StringRef name, const ValueRef value) QQmlData *ddata = QQmlData::get(that->m_object); // Types created by QML are not extensible at run-time, but for other QObjects we can store them // as regular JavaScript properties, like on JavaScript objects. - if (ddata && ddata->compiledData) { + if (ddata && ddata->context) { QString error = QLatin1String("Cannot assign to non-existent property \"") + name->toQString() + QLatin1Char('\"'); v4->currentContext()->throwError(error); -- cgit v1.2.3