Browse Source

Fix a memory leak in TextBatch:add when the internal buffer is resized

Sasha Szpakowski 8 months ago
parent
commit
bd6c90b65d
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/modules/graphics/TextBatch.cpp

+ 2 - 1
src/modules/graphics/TextBatch.cpp

@@ -65,7 +65,8 @@ void TextBatch::uploadVertices(const std::vector<Font::GlyphVertex> &vertices, s
 
 		Buffer::Settings settings(BUFFERUSAGEFLAG_VERTEX, BUFFERDATAUSAGE_DYNAMIC);
 		auto decl = Buffer::getCommonFormatDeclaration(Font::vertexFormat);
-		Buffer *newbuffer = gfx->newBuffer(settings, decl, nullptr, newsize, 0);
+
+		StrongRef<Buffer> newbuffer(gfx->newBuffer(settings, decl, nullptr, newsize, 0), Acquire::NORETAIN);
 
 		void *newdata = nullptr;
 		if (vertexData != nullptr)