aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativevme_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-10-03 15:45:51 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-03 11:43:03 +0200
commit95cd185fa4bfe872458988d0b5ffb36fd1b56bd3 (patch)
tree2e8091c278db670eddb09ebc060581ccb208d27e /src/declarative/qml/qdeclarativevme_p.h
parent0eec42dff07073d9e0cb955b0888f63e073f2a2a (diff)
QDeclarativeIncubator::clear() and autotests
Change-Id: I2a14c01c7f9412459572e9960cb95a4c24e068aa Task-number: QTBUG-21151 Reviewed-on: http://codereview.qt-project.org/5911 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/declarative/qml/qdeclarativevme_p.h')
-rw-r--r--src/declarative/qml/qdeclarativevme_p.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/declarative/qml/qdeclarativevme_p.h b/src/declarative/qml/qdeclarativevme_p.h
index 80c02b1b89..771a2b4c21 100644
--- a/src/declarative/qml/qdeclarativevme_p.h
+++ b/src/declarative/qml/qdeclarativevme_p.h
@@ -120,11 +120,14 @@ public:
void init(QDeclarativeContextData *, QDeclarativeCompiledData *, int start);
bool initDeferred(QObject *);
+ void reset();
QObject *execute(QList<QDeclarativeError> *errors, const Interrupt & = Interrupt());
bool complete(const Interrupt & = Interrupt());
private:
+ friend class QDeclarativeVMEGuard;
+
QObject *run(QList<QDeclarativeError> *errors, const Interrupt &
#ifdef QML_THREADED_VME_INTERPRETER
, void ***storeJumpTable = 0
@@ -138,15 +141,19 @@ private:
#endif
QDeclarativeEngine *engine;
+
QFiniteStack<QObject *> objects;
QFiniteStack<QDeclarativeVMETypes::List> lists;
QFiniteStack<QDeclarativeAbstractBinding *> bindValues;
QFiniteStack<QDeclarativeParserStatus *> parserStatus;
- QDeclarativeContextData *rootContext;
+ QDeclarativeGuardedContextData rootContext;
struct State {
- State() : context(0), compiledData(0), instructionStream(0) {}
+ enum Flag { Deferred = 0x00000001 };
+
+ State() : flags(0), context(0), compiledData(0), instructionStream(0) {}
+ quint32 flags;
QDeclarativeContextData *context;
QDeclarativeCompiledData *compiledData;
const char *instructionStream;
@@ -159,6 +166,27 @@ private:
static void blank(QFiniteStack<QDeclarativeAbstractBinding *> &);
};
+// Used to check that a QDeclarativeVME that is interrupted mid-execution
+// is still valid. Checks all the objects and contexts have not been
+// deleted.
+class QDeclarativeVMEGuard
+{
+public:
+ QDeclarativeVMEGuard();
+ ~QDeclarativeVMEGuard();
+
+ void guard(QDeclarativeVME *);
+ void clear();
+
+ bool isOK() const;
+
+private:
+ int m_objectCount;
+ QDeclarativeGuard<QObject> *m_objects;
+ int m_contextCount;
+ QDeclarativeGuardedContextData *m_contexts;
+};
+
QDeclarativeVME::Interrupt::Interrupt()
: mode(None)
{