From 197a5f642afe9c020d223e3990c31a8947f6ed52 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 15 Oct 2020 20:10:52 +0200 Subject: [PATCH] - properly delete backing images in the texture manager. Although the images themselves are automatically taken down, any memory they allocate is not - and some of the special tile classes do need dynamic storage. --- source/common/platform/win32/i_main.cpp | 2 +- source/common/textures/imagetexture.cpp | 5 +++++ source/common/textures/textures.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/source/common/platform/win32/i_main.cpp b/source/common/platform/win32/i_main.cpp index 6e1b2ea33..01d799998 100644 --- a/source/common/platform/win32/i_main.cpp +++ b/source/common/platform/win32/i_main.cpp @@ -1242,7 +1242,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int _CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF); // Use this to break at a specific allocation number. - //_crtBreakAlloc = 227524; + //_crtBreakAlloc = 291757; #endif int ret = DoMain (hInstance); diff --git a/source/common/textures/imagetexture.cpp b/source/common/textures/imagetexture.cpp index d222733a7..5ec15c7b5 100644 --- a/source/common/textures/imagetexture.cpp +++ b/source/common/textures/imagetexture.cpp @@ -57,6 +57,11 @@ FImageTexture::FImageTexture(FImageSource *img) noexcept } } +FImageTexture::~FImageTexture() +{ + delete mImage; +} + void FImageTexture::SetFromImage() { auto img = mImage; diff --git a/source/common/textures/textures.h b/source/common/textures/textures.h index f8fd763cf..c5a85fd6b 100644 --- a/source/common/textures/textures.h +++ b/source/common/textures/textures.h @@ -357,6 +357,7 @@ protected: void SetFromImage(); public: FImageTexture(FImageSource* image) noexcept; + ~FImageTexture(); TArray Get8BitPixels(bool alphatex) override; void SetImage(FImageSource* img)