aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-10-04 17:21:44 +0200
committerUlf Hermann <ulf.hermann@qt.io>2017-10-05 08:12:00 +0000
commit080a5c705aa9c04a332c2f95a216853b098d9d6b (patch)
tree6e903a5d9187a25cf736c47614812fb970d066dd /src
parent837da5953ff325a5bc5171a0c1f9f7aecd4834e9 (diff)
QV4Engine: Don't cache compilation units to be unlinked
A compilation unit that is unlinked may recursively unlink and delete further compilation units belonging to the same engine via its resolvedTypes property. Those units won't be able to remove themselves from the cached set, and will therefore get their unlink() method called again, this time on a dangling pointer, when the engine gets around to them. Change-Id: Icaa941ca2117c8303c49623b2be0f9014502d849 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 54011e6bd2..34336e3c87 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -478,10 +478,8 @@ ExecutionEngine::~ExecutionEngine()
delete identifierTable;
delete memoryManager;
- QSet<QV4::CompiledData::CompilationUnit*> remainingUnits;
- qSwap(compilationUnits, remainingUnits);
- for (QV4::CompiledData::CompilationUnit *unit : qAsConst(remainingUnits))
- unit->unlink();
+ while (!compilationUnits.isEmpty())
+ (*compilationUnits.begin())->unlink();
internalClasses[Class_Empty]->destroy();
delete classPool;