From 700ba1bcb39e082049c96fafdfaccfe5d83cd77e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 18 Sep 2013 15:34:13 +0200 Subject: Use a StringRef for Managed::get() also store "toString" and "valueOf" as identifiers in the engine and fix two places where we compared strings the wrong way. Change-Id: I70612221e72d43ed0e3c496e4209681bf254cded Reviewed-by: Simon Hausmann --- src/quick/items/context2d/qquickcontext2d.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index f84a6855dd..1dd4e950c6 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -1720,7 +1720,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::SimpleC QV8Engine *engine = ctx->engine->v8Engine; if (ctx->argumentCount == 2) { - QQuickContext2DStyle *pattern = new (v4->memoryManager) QQuickContext2DStyle(v4); + QV4::Scoped pattern(scope, new (v4->memoryManager) QQuickContext2DStyle(v4)); QColor color = engine->toVariant(ctx->arguments[0], qMetaTypeId()).value(); if (color.isValid()) { @@ -1734,7 +1734,8 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::SimpleC QImage patternTexture; if (QV4::Object *o = ctx->arguments[0].asObject()) { - QV4::Scoped pixelData(scope, o->get(ctx->engine->newString(QStringLiteral("data")))); + QV4::ScopedString s(scope, ctx->engine->newString(QStringLiteral("data"))); + QV4::Scoped pixelData(scope, o->get(s)); if (!!pixelData) { patternTexture = pixelData->image; } @@ -1763,7 +1764,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::SimpleC } } - return QV4::Value::fromObject(pattern).asReturnedValue(); + return pattern.asReturnedValue(); } return QV4::Encode::undefined(); -- cgit v1.2.3