aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/context2d/qquickcanvasitem.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 17:36:04 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 17:36:04 +0100
commitad67ec26d0cbc98e3440dd38bb20eef4da2ee96d (patch)
tree9f8135751df2f995a4f55837ea065a4687245b71 /src/quick/items/context2d/qquickcanvasitem.cpp
parent83a16630c13969e68cd3a5aaab73335ccb0d4414 (diff)
parent20d160d0513a04be187ed851a25b029f47c27b27 (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: .qmake.conf LICENSE.GPLv2 examples/qml/networkaccessmanagerfactory/view.qml src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4stringobject.cpp Change-Id: I5d12f436d60995e51d5c2f59d364e9cbc24f8e32
Diffstat (limited to 'src/quick/items/context2d/qquickcanvasitem.cpp')
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 4145b2f6ff..11aff9b95d 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -592,7 +592,9 @@ void QQuickCanvasItem::geometryChanged(const QRectF &newGeometry, const QRectF &
QQuickItem::geometryChanged(newGeometry, oldGeometry);
- QSizeF newSize = newGeometry.size();
+ // Due to indirect recursion, newGeometry may be outdated
+ // after this call, so we use width and height instead.
+ QSizeF newSize = QSizeF(width(), height());
if (!d->hasCanvasSize && d->canvasSize != newSize) {
d->canvasSize = newSize;
emit canvasSizeChanged();
@@ -1124,6 +1126,9 @@ bool QQuickCanvasItem::createContext(const QString &contextType)
{
Q_D(QQuickCanvasItem);
+ if (!window())
+ return false;
+
if (contextType == QLatin1String("2d")) {
if (d->contextType.compare(QLatin1String("2d"), Qt::CaseInsensitive) != 0) {
d->contextType = QLatin1String("2d");