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:
Albert Astals Cid 2015-04-14 16:02:43 +02:00
parent ac31d397a8
commit 2b3c233961
1 changed files with 1 additions and 1 deletions

View File

@ -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"));