aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/context2d
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-11-20 09:53:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-20 10:22:16 +0100
commit8ae390e75bf589b1591cdf5caa77b254b9ac0d8a (patch)
treefedb72167a6f516963020bc220f63eebd9b70b3a /src/quick/items/context2d
parent91364ea88a79ef1dce9dd698285e10d268af1ffe (diff)
Fix bad refcounting for Context2D.drawImage with an image item source.
The pixmap we get from createPixmap is cached internally in the QQuickCanvasItem's cache so we need to refcount it properly. Using take would result in the refcount going to zero in this function which would cause a crash. Task-number: QTBUG-34714 Change-Id: I5f0e75a7117c53e4b89ac133ba7d161bc7b9053d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/quick/items/context2d')
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 3c97452d3d..2a9e0f2ac2 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -2981,7 +2981,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
} else if (arg->isObject()) {
if (QV4::Referenced<QV4::QObjectWrapper> qobjectWrapper = arg->asRef<QV4::QObjectWrapper>()) {
if (QQuickImage *imageItem = qobject_cast<QQuickImage*>(qobjectWrapper->object())) {
- pixmap.take(r->context->createPixmap(imageItem->source()));
+ pixmap = r->context->createPixmap(imageItem->source());
} else if (QQuickCanvasItem *canvas = qobject_cast<QQuickCanvasItem*>(qobjectWrapper->object())) {
QImage img = canvas->toImage();
if (!img.isNull())