From 1a9c69ddb0ae8bac9b53648927e4302b9277f986 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 27 Aug 2010 09:37:01 +0200 Subject: 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 --- src/libs/qmljs/qmljsinterpreter.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/libs/qmljs/qmljsinterpreter.h') diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 5ec91c009d5..67222cd3b02 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -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 qmlComponentScope; QList qmlScopeObjects; const ObjectValue *qmlTypes; QList jsScopes; -- cgit v1.2.3