From c549d9c4e58ef8b6f9c8d954dc24072ce529f326 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 26 Jul 2018 09:49:36 +0200 Subject: Simplify loading of ahead-of-time created QML cache files Consolidate the old "createUnitData" code that used to be a virtual function into the one call site and avoid a malloc that way. By the way of that, the string table gets a guard to prevent accidental registerString() calls at a later point. Change-Id: Ia3f8d3e874b7733822e6942e411c940ec60d95a5 Reviewed-by: Lars Knoll --- src/qml/compiler/qv4compiler.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qml/compiler/qv4compiler.cpp') diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index bc7265ab0c..44b809899f 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -55,6 +55,7 @@ QV4::Compiler::StringTableGenerator::StringTableGenerator() int QV4::Compiler::StringTableGenerator::registerString(const QString &str) { + Q_ASSERT(!frozen); QHash::ConstIterator it = stringToId.constFind(str); if (it != stringToId.cend()) return *it; @@ -75,6 +76,7 @@ void QV4::Compiler::StringTableGenerator::clear() strings.clear(); stringToId.clear(); stringDataSize = 0; + frozen = false; } void QV4::Compiler::StringTableGenerator::initializeFromBackingUnit(const QV4::CompiledData::Unit *unit) -- cgit v1.2.3