From 58bdf5c49c1ce4229f00e8cd404381e3057b0e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 9 Jan 2012 08:54:11 +0100 Subject: We should return texture id 0 for invalid images and pixmaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in the texture cache Change-Id: Ib9bb136fa451c571fce2adbee29998b3f3593b31 Reviewed-by: Samuel Rødal --- src/gui/opengl/qopengltexturecache.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp index 4806a9d5ff..a93ae91354 100644 --- a/src/gui/opengl/qopengltexturecache.cpp +++ b/src/gui/opengl/qopengltexturecache.cpp @@ -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(); -- cgit v1.2.3