aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Brooks <john.brooks@qt.io>2016-10-26 13:20:21 -0600
committerJohn Brooks <john.brooks@dereferenced.net>2016-10-27 14:46:26 +0000
commitaf9f8ffb479e35d131f2ff9bedc7cf46842f93ff (patch)
tree737465a14420066ca39c504d09005f3072524541
parentc849f3a7eff55d60c4010831ec67336c5c0f2a27 (diff)
Fix crash when trying to allocate in a filled atlas texture
Atlas::create returns null when allocating space in the atlas texture fails, including when the texture is full. Manager::create assumed that this function would never fail. Change-Id: I2ed8a1b94640d6a3cc65011e83b88f8bd42ca074 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 1a1f0d37f7..e163191c6e 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -110,8 +110,9 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel)
if (image.width() < m_atlas_size_limit && image.height() < m_atlas_size_limit) {
if (!m_atlas)
m_atlas = new Atlas(m_atlas_size);
+ // t may be null for atlas allocation failure
t = m_atlas->create(image);
- if (!hasAlphaChannel && t->hasAlphaChannel())
+ if (t && !hasAlphaChannel && t->hasAlphaChannel())
t->setHasAlphaChannel(false);
}
return t;