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:
@@ -242,8 +242,10 @@ class QMLJS_EXPORT ScopeChain
|
||||
public:
|
||||
ScopeChain();
|
||||
|
||||
struct QmlComponentChain
|
||||
class QmlComponentChain
|
||||
{
|
||||
Q_DISABLE_COPY(QmlComponentChain)
|
||||
public:
|
||||
QmlComponentChain();
|
||||
~QmlComponentChain();
|
||||
|
||||
@@ -255,7 +257,7 @@ public:
|
||||
};
|
||||
|
||||
const ObjectValue *globalScope;
|
||||
QmlComponentChain qmlComponentScope;
|
||||
QSharedPointer<QmlComponentChain> qmlComponentScope;
|
||||
QList<const ObjectValue *> qmlScopeObjects;
|
||||
const ObjectValue *qmlTypes;
|
||||
QList<const ObjectValue *> jsScopes;
|
||||
|
||||
Reference in New Issue
Block a user