diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-10-15 15:00:24 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-15 20:57:37 +0200 |
commit | b538231cb2409d9d6eb87161930b53b004aed3ac (patch) | |
tree | 7a8bc0d0a2d4349f963459325294ea49a6b1b1fb /src/qml/jsruntime/qv4regexpobject.cpp | |
parent | e20253ed7a11ac65594ca88c933739d6c01b446d (diff) |
Fix GC issues with usage of raw RegExp pointers
Properly protect them through Scoped values.
Change-Id: I5a0a1d5580d55ecff493419baa8959751a65f1d3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index 4adee433aa..6eaa8c387d 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -79,7 +79,7 @@ RegExpObject::RegExpObject(InternalClass *ic) init(ic->engine); } -RegExpObject::RegExpObject(ExecutionEngine *engine, RegExp* value, bool global) +RegExpObject::RegExpObject(ExecutionEngine *engine, Referenced<RegExp> value, bool global) : Object(engine->regExpClass) , value(value) , global(global) @@ -251,7 +251,8 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData) if (!f->isUndefined()) ctx->throwTypeError(); - return Encode(ctx->engine->newRegExpObject(re->value, re->global)); + Scoped<RegExp> newRe(scope, re->value); + return Encode(ctx->engine->newRegExpObject(newRe, re->global)); } QString pattern; @@ -277,7 +278,7 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData) } } - RegExp *regexp = RegExp::create(ctx->engine, pattern, ignoreCase, multiLine); + Scoped<RegExp> regexp(scope, RegExp::create(ctx->engine, pattern, ignoreCase, multiLine)); if (!regexp->isValid()) ctx->throwSyntaxError(0); |