From 5e3ca0e781d270186306de89e3393da5af41eb2a Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Sun, 27 Jun 2021 12:42:53 -0700 Subject: [PATCH] Fixed loading textures from cached pieces. --- common/lc_mesh.cpp | 1 + common/pieceinf.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/lc_mesh.cpp b/common/lc_mesh.cpp index 2658b3e4..df356a66 100644 --- a/common/lc_mesh.cpp +++ b/common/lc_mesh.cpp @@ -424,6 +424,7 @@ bool lcMesh::FileLoad(lcMemFile& File) FileName[Length] = 0; Section.Texture = lcGetPiecesLibrary()->FindTexture(FileName, nullptr, false); + Section.Texture->AddRef(); } else Section.Texture = nullptr; diff --git a/common/pieceinf.cpp b/common/pieceinf.cpp index 5b78f5d4..f1bc03e0 100644 --- a/common/pieceinf.cpp +++ b/common/pieceinf.cpp @@ -168,7 +168,7 @@ void PieceInfo::ReleaseMesh() lcMeshSection& Section = mMesh->mLods[LodIdx].Sections[SectionIdx]; if (Section.Texture) - lcGetPiecesLibrary()->ReleaseTexture(Section.Texture); + Section.Texture->Release(); } }