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 <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Timur Pocheptsov 2016-04-15 15:16:41 +02:00
parent 418b6f6899
commit a4a83f52f9

View File

@ -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)