From cc8a76ce8ea76afe912902067e95ca2abf9e482f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 16 Sep 2014 13:34:15 +0200 Subject: Fix crash when borders exceed item width/height in border image While we protected against the the borders exceeding the size of the source image when deciding whether to create a given patch, we did not protect against the case where the target rectangle is smaller than the borders. To fix this, we simply move the calculation of the target rectangle up to before we create the nodes, and check for isEmpty() before creating the nodes. In addition, we did not properly handle changing the borders dynamically. The subtree has to be rebuilt if the borders change so that the source or target rectangles change. Change-Id: Ia6a0df616ebbd0a32924de0b63fd48043027930a Task-number: QTBUG-41338 Reviewed-by: Gunnar Sletta --- src/quick/items/qquickimagebase_p_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/quick/items/qquickimagebase_p_p.h') diff --git a/src/quick/items/qquickimagebase_p_p.h b/src/quick/items/qquickimagebase_p_p.h index f30eacb4ac..ec2f0bb73e 100644 --- a/src/quick/items/qquickimagebase_p_p.h +++ b/src/quick/items/qquickimagebase_p_p.h @@ -75,6 +75,8 @@ public: QSize sourcesize; QSize oldSourceSize; qreal devicePixelRatio; + QRectF oldInnerSourceRect; + QRectF oldInnerTargetRect; bool async : 1; bool cache : 1; bool mirror: 1; -- cgit v1.2.3