aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2015-04-14 16:02:43 +0200
committerAlbert Astals Cid <albert.astals@canonical.com>2015-04-14 15:24:14 +0000
commit2b3c2339616680537145a9cc2e7567575add1abb (patch)
tree84ac285d8633e1d4b2fedbe0a2c182de88320e89
parentac31d397a8a82a0a5b5b1276025e55371c3c9972 (diff)
Protect the RegExp against early garbage collection
Backported from Qt 5.5 Change-Id: Ice9fd8061fac0c35d787e1603873c69f8ef7e10b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index c48175247e..e7f30c6671 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -286,7 +286,7 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
}
}
- RegExp *regexp = reinterpret_cast<RegExp *>(RegExp::create(ctx->d()->engine, pattern, ignoreCase, multiLine));
+ Scoped<RegExp> regexp(scope, RegExp::create(ctx->d()->engine, pattern, ignoreCase, multiLine));
if (!regexp->isValid())
return ctx->throwSyntaxError(QStringLiteral("Invalid regular expression"));