From 8088d457317ada9f796899f49033204af5d31cb9 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 23 Feb 2024 11:44:57 -0500 Subject: [PATCH] Fix --- LEGO1/lego/sources/misc/legocontainer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/sources/misc/legocontainer.cpp b/LEGO1/lego/sources/misc/legocontainer.cpp index 1b1189b0..558526dd 100644 --- a/LEGO1/lego/sources/misc/legocontainer.cpp +++ b/LEGO1/lego/sources/misc/legocontainer.cpp @@ -88,7 +88,7 @@ LegoTextureInfo* LegoTextureContainer::Insert(LegoTextureInfo* p_textureInfo) textureInfo->m_surface->Release(); textureInfo->m_palette->Release(); delete textureInfo; - textureInfo = NULL; + return NULL; } else { if (((TglImpl::RendererImpl*) VideoManager()->GetRenderer()) @@ -96,12 +96,14 @@ LegoTextureInfo* LegoTextureContainer::Insert(LegoTextureInfo* p_textureInfo) textureInfo->m_surface->Release(); textureInfo->m_palette->Release(); delete textureInfo; - textureInfo = NULL; + return NULL; } else { textureInfo->m_texture->SetAppData((DWORD) textureInfo); m_list.push_back(LegoTextureListElement(textureInfo, TRUE)); + textureInfo->m_texture->AddRef(); + if (textureInfo->m_name != NULL) { delete[] textureInfo->m_name; }