aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2021-11-10 14:15:24 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-11 13:26:03 +0000
commitb97047ac41b367b47556009a7a78640455881a0b (patch)
tree4ac009029f333e5acaf8cee2a107727fbb4890b8
parent5862c836a7e6c4420ecf694affa91f527f18e4c0 (diff)
Use resize instead of shrink when clearing upload pools
Fix creator qml puppet crash at startup due to nullptr exception. The puppet clears the cached resources, which calls shrink(0) to the vertex and index upload pools. The shrink only sets the capacity to 0 and deallocates the buffer, but leaves the size intact. The next time the upload pools are used they are not reallocated, because only the size gets checked. Use resize instead of shrink since it calls the shrink and also sets the size to zero. Fixes: QTBUG-98150 Change-Id: Id852e71d4caa0f6c5ca560142024ca9d143df7f8 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 3bf5e8b671e0f7be7f3fa5004aedbb2f9838c56a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index f1e3fa8b2e..990d4dcac9 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -991,8 +991,8 @@ void Renderer::releaseCachedResources()
m_rhi->releaseCachedResources();
- m_vertexUploadPool.shrink(0);
- m_indexUploadPool.shrink(0);
+ m_vertexUploadPool.resize(0);
+ m_indexUploadPool.resize(0);
}
void Renderer::invalidateAndRecycleBatch(Batch *b)