From a4a83f52f9ee862d703c21dcd9915ebfd7c72ac5 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 15 Apr 2016 15:16:41 +0200 Subject: OGLTextureCache::insert - make sure it did not fail QGLTextureCache is using QCache internally, QCache in theory can delete the object we are trying to insert (in case the cost > maxCost). Vague comments in the code suggest that this can never happen. Q_ASSERT assert this. Found by coverity, CID 11765 Change-Id: I34ef114b9607926cd5e7d2baed4b63051cf87cff Reviewed-by: Laszlo Agocs --- src/opengl/qgl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 5c8c1d58eb..a17beb898d 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1918,7 +1918,8 @@ void QGLTextureCache::insert(QGLContext* ctx, qint64 key, QGLTexture* texture, i { QWriteLocker locker(&m_lock); const QGLTextureCacheKey cacheKey = {key, QGLContextPrivate::contextGroup(ctx)}; - m_cache.insert(cacheKey, texture, cost); + const bool inserted = m_cache.insert(cacheKey, texture, cost); + Q_UNUSED(inserted) Q_ASSERT(inserted); } void QGLTextureCache::remove(qint64 key) -- cgit v1.2.3