diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-24 10:42:18 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-08-24 10:44:53 +0000 |
commit | 4898ddfcc1822dbffc179f77a2fe768d231cbc6c (patch) | |
tree | dddc80571d1401902d949c707b6f2899b9ba10e6 /src/qml/jsruntime/qv4persistent_p.h | |
parent | c907eb1b5bfc22ffcee1cc37ecfa762d7a3edd0a (diff) |
Make iteration over persistent values safer
This makes it safe to destruct persistents while
we are iterating over them.
Change-Id: I8797d0c553d3201859cdf03fb25df28836e55691
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4persistent_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4persistent_p.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4persistent_p.h b/src/qml/jsruntime/qv4persistent_p.h index 858734e9ed..67a76742d1 100644 --- a/src/qml/jsruntime/qv4persistent_p.h +++ b/src/qml/jsruntime/qv4persistent_p.h @@ -51,8 +51,10 @@ struct Q_QML_EXPORT PersistentValueStorage void mark(ExecutionEngine *e); struct Iterator { - Q_DECL_CONSTEXPR Iterator(void *p, int idx) - : p(p), index(idx) {} + Iterator(void *p, int idx); + Iterator(const Iterator &o); + Iterator & operator=(const Iterator &o); + ~Iterator(); void *p; int index; Iterator &operator++(); @@ -68,6 +70,8 @@ struct Q_QML_EXPORT PersistentValueStorage ExecutionEngine *engine; void *firstPage; +private: + static void freePage(void *page); }; class Q_QML_EXPORT PersistentValue |