diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-04-16 09:36:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-28 12:49:53 +0200 |
commit | 52fcb218c379bb2008e24a2b5b00b613219ba7f6 (patch) | |
tree | ff19d8e3c509a96fc0ced9c60607c2430970a538 /src/qml/jsruntime/qv4engine.cpp | |
parent | 50d7c049e3310d4d9194c2efb5150e4e5a50e5ca (diff) |
Fix marking of prototype objects in internal class pool
As per reported bug, we have to protect ourselves against potential loops
and can mark the internal classes much simpler by just walking through
the memory pool they were allocated in.
Task-number: QTBUG-38299
Change-Id: I3ae96e8082e76d06f4321c5aa6d2e9645d2830a0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index b95197e16b..8916cc597e 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -215,7 +215,9 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) identifierTable = new IdentifierTable(this); - emptyClass = new (classPool.allocate(sizeof(InternalClass))) InternalClass(this); + classPool = new InternalClassPool; + + emptyClass = new (classPool) InternalClass(this); executionContextClass = InternalClass::create(this, ExecutionContext::staticVTable(), 0); constructClass = InternalClass::create(this, Object::staticVTable(), 0); stringClass = InternalClass::create(this, String::staticVTable(), 0); @@ -429,6 +431,7 @@ ExecutionEngine::~ExecutionEngine() delete m_qmlExtensions; emptyClass->destroy(); + delete classPool; delete bumperPointerAllocator; delete regExpCache; delete regExpAllocator; @@ -464,7 +467,7 @@ void ExecutionEngine::initRootContext() InternalClass *ExecutionEngine::newClass(const InternalClass &other) { - return new (classPool.allocate(sizeof(InternalClass))) InternalClass(other); + return new (classPool) InternalClass(other); } ExecutionContext *ExecutionEngine::pushGlobalContext() @@ -897,7 +900,7 @@ void ExecutionEngine::markObjects() if (m_qmlExtensions) m_qmlExtensions->markObjects(this); - emptyClass->markObjects(); + classPool->markObjects(this); for (QSet<CompiledData::CompilationUnit*>::ConstIterator it = compilationUnits.constBegin(), end = compilationUnits.constEnd(); it != end; ++it) |