We should return texture id 0 for invalid images and pixmaps
authorJørgen Lind <jorgen.lind@nokia.com>
Mon, 9 Jan 2012 07:54:11 +0000 (08:54 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 10 Jan 2012 08:13:11 +0000 (09:13 +0100)
in the texture cache

Change-Id: Ib9bb136fa451c571fce2adbee29998b3f3593b31
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/gui/opengl/qopengltexturecache.cpp

index 4806a9d..a93ae91 100644 (file)
@@ -107,6 +107,8 @@ QOpenGLTextureCache::~QOpenGLTextureCache()
 
 GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &pixmap)
 {
+    if (pixmap.isNull())
+        return 0;
     QMutexLocker locker(&m_mutex);
     qint64 key = pixmap.cacheKey();
 
@@ -128,6 +130,8 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &
 
 GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &image)
 {
+    if (image.isNull())
+        return 0;
     QMutexLocker locker(&m_mutex);
     qint64 key = image.cacheKey();