From d736b58d2481af9c68879d75ba73cee47e9837e1 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 11 Oct 2013 14:58:45 +0200 Subject: Fix possible crashes This can (and does crash) when a gc gets triggered during the linking stage of a compilation unit. Change-Id: I06f1299adab68ff8e0a4755d02e246870797e7f2 Reviewed-by: Simon Hausmann --- src/qml/compiler/qv4compileddata.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/qml') diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index cd467300be..887edc0b10 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -98,6 +98,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) if (data->lookupTableSize) { runtimeLookups = new QV4::Lookup[data->lookupTableSize]; + memset(runtimeLookups, 0, data->lookupTableSize * sizeof(QV4::Lookup)); const CompiledData::Lookup *compiledLookups = data->lookupTable(); for (uint i = 0; i < data->lookupTableSize; ++i) { QV4::Lookup *l = runtimeLookups + i; @@ -166,13 +167,17 @@ void CompilationUnit::markObjects() { for (int i = 0; i < data->stringTableSize; ++i) runtimeStrings[i].mark(); - for (int i = 0; i < data->regexpTableSize; ++i) - runtimeRegularExpressions[i].mark(); + if (runtimeRegularExpressions) { + for (int i = 0; i < data->regexpTableSize; ++i) + runtimeRegularExpressions[i].mark(); + } for (int i = 0; i < runtimeFunctions.count(); ++i) if (runtimeFunctions[i]) runtimeFunctions[i]->mark(); - for (int i = 0; i < data->lookupTableSize; ++i) - runtimeLookups[i].name->mark(); + if (runtimeLookups) { + for (int i = 0; i < data->lookupTableSize; ++i) + runtimeLookups[i].name->mark(); + } } QString Binding::valueAsString(const Unit *unit) const -- cgit v1.2.3