aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-04 11:35:02 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-04 14:45:30 +0100
commitc6da58a295235c89ee2a5847b15cb0b1dc66b2f4 (patch)
tree069e86a0806921f88b4c5ed2f2e00a3e5ba4a379 /src/quick
parent33d5e6996f5ae4131c2233c4da5500e4ebda99ea (diff)
Fix occasional crashes in canvas getImageData and other places
In some places we allocate custom array objects and in the constructor we call setArrayType, which will allocate the array's data through the GC. In all of these cases we need to make sure that the array object itself is protected from garbage collection, because while in the constructor it may not be yet in the scope the callee has usually set up. Change-Id: I96b7af4ae00fd809067e12bacd6563984c5e9240 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index a01ce5db90..f32cf7cbcd 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -871,6 +871,9 @@ struct QQuickJSContext2DPixelData : public QV4::Object
: QV4::Object(engine)
{
setVTable(staticVTable());
+ QV4::Scope scope(engine);
+ QV4::ScopedObject protectThis(scope, this);
+ Q_UNUSED(protectThis);
setArrayType(QV4::ArrayData::Custom);
}