forked from qt-creator/qt-creator
QmlJS: Fix crash when opening JS files.
Now that Contexts are cached, it needs to be copyable. However, the ScopeChain has a QmlComponentChain member that owns resources and didn't have a correct copy constructor or copy assignment operator. I've made QmlComponentChain non-copyable and store a shared pointer to an instance instead, as it will generally not change for a given context. Reviewed-by: Lasse Holmstedt
This commit is contained in:
@@ -1392,15 +1392,17 @@ void ScopeChain::update()
|
||||
|
||||
// the root scope in js files doesn't see instantiating components
|
||||
if (jsScopes.count() != 1 || !qmlScopeObjects.isEmpty()) {
|
||||
foreach (QmlComponentChain *parent, qmlComponentScope.instantiatingComponents)
|
||||
parent->add(&_all);
|
||||
if (qmlComponentScope) {
|
||||
foreach (QmlComponentChain *parent, qmlComponentScope->instantiatingComponents)
|
||||
parent->add(&_all);
|
||||
}
|
||||
}
|
||||
|
||||
ObjectValue *root = 0;
|
||||
ObjectValue *ids = 0;
|
||||
if (qmlComponentScope.document) {
|
||||
root = qmlComponentScope.document->bind()->rootObjectValue();
|
||||
ids = qmlComponentScope.document->bind()->idEnvironment();
|
||||
if (qmlComponentScope && qmlComponentScope->document) {
|
||||
root = qmlComponentScope->document->bind()->rootObjectValue();
|
||||
ids = qmlComponentScope->document->bind()->idEnvironment();
|
||||
}
|
||||
|
||||
if (root && !qmlScopeObjects.contains(root))
|
||||
|
Reference in New Issue
Block a user