Protect the RegExp against early garbage collection
Backported from Qt 5.5 Change-Id: Ice9fd8061fac0c35d787e1603873c69f8ef7e10b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This commit is contained in:
parent
ac31d397a8
commit
2b3c233961
|
@ -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"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue