aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-10-11 14:58:45 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-11 19:33:41 +0200
commitd736b58d2481af9c68879d75ba73cee47e9837e1 (patch)
tree37db28ea099af4fcd68da4031360fb0656195637 /src/qml
parent8402ac0e3de391d20148c3a204f8f3822ac34b14 (diff)
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 <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/compiler/qv4compileddata.cpp13
1 files changed, 9 insertions, 4 deletions
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