aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-09-27 17:04:03 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-28 10:33:18 +0200
commit9a8466839b030a4ffebf74a813737d7cc55aa1d0 (patch)
tree35e23952911fb66d20af07a07031a7203aa7237b
parent8469bc9cf1a4ef4ff6f51775569002135f739686 (diff)
Don't crash when Image.source change
QDeclarativePixmap::clear() may result in the texture being scheduled for deletion, so we need to make sure that our texture provider is updated properly whenever the source changes. Change-Id: Ie21c6fcba4b0cd438250dc4c263b513060cc026e Reviewed-on: http://codereview.qt-project.org/5673 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
-rw-r--r--src/declarative/items/qsgimage.cpp4
-rw-r--r--src/declarative/items/qsgimagebase.cpp1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/declarative/items/qsgimage.cpp b/src/declarative/items/qsgimage.cpp
index 8cf85997cb..92b454b695 100644
--- a/src/declarative/items/qsgimage.cpp
+++ b/src/declarative/items/qsgimage.cpp
@@ -704,6 +704,10 @@ void QSGImage::pixmapChange()
QSGImageBase::pixmapChange();
updatePaintedGeometry();
d->pixmapChanged = true;
+
+ // Make sure we update the texture provider when the image has changed.
+ if (d->provider)
+ update();
}
QSGImage::VAlignment QSGImage::verticalAlignment() const
diff --git a/src/declarative/items/qsgimagebase.cpp b/src/declarative/items/qsgimagebase.cpp
index 5c6334de66..0c08010d34 100644
--- a/src/declarative/items/qsgimagebase.cpp
+++ b/src/declarative/items/qsgimagebase.cpp
@@ -208,6 +208,7 @@ void QSGImageBase::load()
if (d->cache)
options |= QDeclarativePixmap::Cache;
d->pix.clear(this);
+ pixmapChange();
d->pix.load(qmlEngine(this), d->url, d->explicitSourceSize ? sourceSize() : QSize(), options);
if (d->pix.isLoading()) {