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-15 06:14:55 +0000
commit8e6c2e3e5d89b2598eb5426d96be43ff3dee3154 (patch)
treedde131a2a1b5c9908f6a7928b0ffd0f1107c0d65
parentbe32898873237dfd6864112e5242a30f3e680413 (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 7d2129b247..43093ef6a4 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -1134,8 +1134,8 @@ void Renderer::releaseCachedResources()
if (m_rhi)
m_rhi->releaseCachedResources();
- m_vertexUploadPool.shrink(0);
- m_indexUploadPool.shrink(0);
+ m_vertexUploadPool.resize(0);
+ m_indexUploadPool.resize(0);
}
void Renderer::invalidateAndRecycleBatch(Batch *b)