aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-11-26 10:01:56 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2013-11-26 10:02:56 +0100
commitee6aa999ab0439dcb7a95af3dc9905a6daf13491 (patch)
tree8c83fc72ce62676b8431a1226f9cb9d6f39da4a0 /src/qml/qml
parentf449534020adc8623ebfced5daae331ef56c4421 (diff)
parentce38c71b1c300f700a9ff004b7c163cc290ecae9 (diff)
Merge branch 'release' of ssh://codereview.qt-project.org/qt/qtdeclarative into stable
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlcompiler.cpp6
-rw-r--r--src/qml/qml/qqmlcompiler_p.h1
-rw-r--r--src/qml/qml/qqmldata_p.h5
-rw-r--r--src/qml/qml/qqmlengine.cpp21
4 files changed, 23 insertions, 10 deletions
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index 79fc3ba303..54fd002f7b 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -3630,8 +3630,6 @@ bool QQmlCompiler::completeComponentBuild()
QQmlJS::Engine *jsEngine = parser.jsEngine();
QQmlJS::MemoryPool *pool = jsEngine->pool();
- QHash<int, QString> expressionNames;
-
for (JSBindingReference *b = compileState->bindings.first(); b; b = b->nextReference) {
JSBindingReference &binding = *b;
@@ -3648,7 +3646,7 @@ bool QQmlCompiler::completeComponentBuild()
ComponentCompileState::PerObjectCompileData *cd = &compileState->jsCompileData[b->bindingContext.object];
cd->functionsToCompile.append(node);
binding.compiledIndex = cd->functionsToCompile.count() - 1;
- expressionNames.insert(binding.compiledIndex, binding.property->name().toString().prepend(QStringLiteral("expression for ")));
+ cd->expressionNames.insert(binding.compiledIndex, binding.property->name().toString().prepend(QStringLiteral("expression for ")));
if (componentStats)
componentStats->componentStat.scriptBindings.append(b->value->location);
@@ -3681,7 +3679,7 @@ bool QQmlCompiler::completeComponentBuild()
jsCodeGen.beginObjectScope(scopeObject->metatype);
- cd->runtimeFunctionIndices = jsCodeGen.generateJSCodeForFunctionsAndBindings(cd->functionsToCompile, expressionNames);
+ cd->runtimeFunctionIndices = jsCodeGen.generateJSCodeForFunctionsAndBindings(cd->functionsToCompile, cd->expressionNames);
QList<QQmlError> errors = jsCodeGen.errors();
if (!errors.isEmpty()) {
exceptions << errors;
diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h
index 2e3e6b8f4c..3ca4566e41 100644
--- a/src/qml/qml/qqmlcompiler_p.h
+++ b/src/qml/qml/qqmlcompiler_p.h
@@ -315,6 +315,7 @@ namespace QQmlCompilerTypes {
QList<QQmlJS::AST::Node*> functionsToCompile;
QVector<int> runtimeFunctionIndices;
QVector<CompiledMetaMethod> compiledMetaMethods;
+ QHash<int, QString> expressionNames;
};
QHash<QQmlScript::Object *, PerObjectCompileData> jsCompileData;
};
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index 76d03f011e..621b3d3c2e 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -79,7 +79,7 @@ class Q_QML_PRIVATE_EXPORT QQmlData : public QAbstractDeclarativeData
{
public:
QQmlData()
- : ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
+ : ownedByQml1(false), ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
hasTaintedV8Object(false), isQueuedForDeletion(false), rootObjectInCreation(false),
hasVMEMetaObject(false), parentFrozen(false), notifyList(0), context(0), outerContext(0),
bindings(0), signalHandlers(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0),
@@ -113,6 +113,7 @@ public:
if (!explicitIndestructibleSet) indestructible = false;
}
+ quint32 ownedByQml1:1; // This bit is shared with QML1's QDeclarativeData.
quint32 ownMemory:1;
quint32 ownContext:1;
quint32 indestructible:1;
@@ -126,7 +127,7 @@ public:
quint32 rootObjectInCreation:1;
quint32 hasVMEMetaObject:1;
quint32 parentFrozen:1;
- quint32 dummy:23;
+ quint32 dummy:22;
struct NotifyList {
quint64 connectionMask;
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 67e1556486..1eec710c84 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -615,12 +615,18 @@ void QQmlPrivate::qdeclarativeelement_destructor(QObject *o)
void QQmlData::destroyed(QAbstractDeclarativeData *d, QObject *o)
{
- static_cast<QQmlData *>(d)->destroyed(o);
+ QQmlData *ddata = static_cast<QQmlData *>(d);
+ if (ddata->ownedByQml1)
+ return;
+ ddata->destroyed(o);
}
void QQmlData::parentChanged(QAbstractDeclarativeData *d, QObject *o, QObject *p)
{
- static_cast<QQmlData *>(d)->parentChanged(o, p);
+ QQmlData *ddata = static_cast<QQmlData *>(d);
+ if (ddata->ownedByQml1)
+ return;
+ ddata->parentChanged(o, p);
}
class QQmlThreadNotifierProxyObject : public QObject
@@ -649,6 +655,7 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in
{
QQmlData *ddata = QQmlData::get(object, false);
if (!ddata) return; // Probably being deleted
+ if (ddata->ownedByQml1) return;
// In general, QML only supports QObject's that live on the same thread as the QQmlEngine
// that they're exposed to. However, to make writing "worker objects" that calculate data
@@ -706,12 +713,18 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in
int QQmlData::receivers(QAbstractDeclarativeData *d, const QObject *, int index)
{
- return static_cast<QQmlData *>(d)->endpointCount(index);
+ QQmlData *ddata = static_cast<QQmlData *>(d);
+ if (ddata->ownedByQml1)
+ return 0;
+ return ddata->endpointCount(index);
}
bool QQmlData::isSignalConnected(QAbstractDeclarativeData *d, const QObject *, int index)
{
- return static_cast<QQmlData *>(d)->signalHasEndpoint(index);
+ QQmlData *ddata = static_cast<QQmlData *>(d);
+ if (ddata->ownedByQml1)
+ return false;
+ return ddata->signalHasEndpoint(index);
}
int QQmlData::endpointCount(int index)