diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-11-10 21:27:52 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-12 12:13:47 +0100 |
commit | 345a5ee67bf80f7c18869fe080bf7dd7cf4a0d90 (patch) | |
tree | 3d4a64aca5d5215a4e3574e3c92f875fe52f90dd /src/qml/jsruntime/qv4stringobject.cpp | |
parent | 60f3c23f524eaed795dd4ce58722cdf923ba6a51 (diff) |
Use heap objects in the remaining managed objects
Change-Id: Id6dc6e34113a287a40e0122dfbdf977f0fc1f3b3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4stringobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 57c12390ff..a21f2b284a 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -606,8 +606,9 @@ ReturnedValue StringPrototype::method_search(CallContext *ctx) regExp = regExpValue->as<RegExpObject>(); Q_ASSERT(regExp); } + Scoped<RegExp> re(scope, regExp->value()); uint* matchOffsets = (uint*)alloca(regExp->value()->captureCount() * 2 * sizeof(uint)); - uint result = regExp->value()->match(string, /*offset*/0, matchOffsets); + uint result = re->match(string, /*offset*/0, matchOffsets); if (result == JSC::Yarr::offsetNoMatch) return Encode(-1); return Encode(result); @@ -670,7 +671,7 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx) Scoped<RegExpObject> re(scope, separatorValue); if (re) { - if (re->value()->pattern().isEmpty()) { + if (re->value()->pattern.isEmpty()) { re = (RegExpObject *)0; separatorValue = ctx->d()->engine->newString(QString()); } @@ -681,7 +682,8 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx) uint offset = 0; uint* matchOffsets = (uint*)alloca(re->value()->captureCount() * 2 * sizeof(uint)); while (true) { - uint result = re->value()->match(text, offset, matchOffsets); + Scoped<RegExp> regexp(scope, re->value()); + uint result = regexp->match(text, offset, matchOffsets); if (result == JSC::Yarr::offsetNoMatch) break; |