diff --git a/src/common/textures/image.cpp b/src/common/textures/image.cpp index 95ee7d23c..82f04b28b 100644 --- a/src/common/textures/image.cpp +++ b/src/common/textures/image.cpp @@ -42,7 +42,7 @@ #include "palettecontainer.h" FMemArena ImageArena(32768); -TArrayFImageSource::ImageForLump; +TArray>FImageSource::ImageForLump; int FImageSource::NextID; static PrecacheInfo precacheInfo; @@ -373,7 +373,7 @@ FImageSource * FImageSource::GetImage(int lumpnum, bool isflat) for (; size < ImageForLump.Size(); size++) ImageForLump[size] = nullptr; } // An image for this lump already exists. We do not need another one. - if (ImageForLump[lumpnum] != nullptr) return ImageForLump[lumpnum]; + if (ImageForLump[lumpnum] != nullptr) return ImageForLump[lumpnum].get(); auto data = fileSystem.OpenFileReader(lumpnum); if (!data.isOpen()) @@ -386,7 +386,7 @@ FImageSource * FImageSource::GetImage(int lumpnum, bool isflat) auto image = CreateInfo[i].TryCreate(data, lumpnum); if (image != nullptr) { - ImageForLump[lumpnum] = image; + ImageForLump[lumpnum].reset(image); return image; } } diff --git a/src/common/textures/image.h b/src/common/textures/image.h index 72b5ca9df..583c5e77a 100644 --- a/src/common/textures/image.h +++ b/src/common/textures/image.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "tarray.h" #include "bitmap.h" #include "memarena.h" @@ -63,7 +64,7 @@ class FImageSource friend class FBrightmapTexture; protected: - static TArrayImageForLump; + static TArray> ImageForLump; static int NextID; int SourceLump;