From 6ff91f8ebc1ace835fd365630ab3c6c7f7819847 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 11 Dec 2022 10:18:38 +0100 Subject: [PATCH] - disable the freelist management for discarded tiles. This does not work as implemented - may be checked out later, but this is not essential. --- source/core/textures/tiletexture.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/core/textures/tiletexture.cpp b/source/core/textures/tiletexture.cpp index bed8df7b9..ce0af3314 100644 --- a/source/core/textures/tiletexture.cpp +++ b/source/core/textures/tiletexture.cpp @@ -299,7 +299,11 @@ static FImageSource* GetTileImage(const TArray& backingstore, uint32_t void* mem = nullptr; if (freelist.Size() > 0) freelist.Pop(mem); // recycle discarded image sources if available. They are all the same type so this is safe. - if (mem) tex = new(mem) FArtTile(backingstore, offset, width, height); + if (mem) + { + memset(mem, 0, sizeof(FArtTile)); + tex = new(mem) FArtTile(backingstore, offset, width, height); + } else tex = new FArtTile(backingstore, offset, width, height); auto p = &backingstore[offset]; auto siz = width * height; @@ -361,7 +365,10 @@ static void GetImagesFromFile(TArray& array, TArray& pi if (array[i] && i < oldsize) { array[i]->~FImageSource(); // really a no-op but let's stay on the safe side. +#if 0 + // recycling items causes corruption so disable for now and revisit later. freelist.Push(array[i]); +#endif } array[i] = nullptr; continue;