From 026ff211fb3117ba3e06d63e55fa291f8e869261 Mon Sep 17 00:00:00 2001 From: Uladzislau Nikalayevich Date: Thu, 26 Sep 2024 19:03:17 +0300 Subject: [PATCH] Fix crash --- Client/mods/deathmatch/logic/CClientModel.cpp | 3 --- Client/mods/deathmatch/logic/CClientModelManager.cpp | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientModel.cpp b/Client/mods/deathmatch/logic/CClientModel.cpp index 2a9eeb0c8d..795bc08579 100644 --- a/Client/mods/deathmatch/logic/CClientModel.cpp +++ b/Client/mods/deathmatch/logic/CClientModel.cpp @@ -84,9 +84,6 @@ bool CClientModel::Deallocate() if (!m_bAllocatedByUs) return false; - if (m_pParentResource) - m_pParentResource->GetResourceModelStreamer()->FullyReleaseModel(m_iModelID); - SetParentResource(nullptr); CModelInfo* pModelInfo = g_pGame->GetModelInfo(m_iModelID, true); diff --git a/Client/mods/deathmatch/logic/CClientModelManager.cpp b/Client/mods/deathmatch/logic/CClientModelManager.cpp index 21d795e964..496310827e 100644 --- a/Client/mods/deathmatch/logic/CClientModelManager.cpp +++ b/Client/mods/deathmatch/logic/CClientModelManager.cpp @@ -49,6 +49,9 @@ bool CClientModelManager::Remove(const std::shared_ptr& pModel) int modelId = pModel->GetModelID(); if (m_Models[modelId] != nullptr) { + CResource* perentResource = m_Models[modelId]->GetParentResource(); + if (perentResource) + perentResource->GetResourceModelStreamer()->FullyReleaseModel(modelId); m_Models[modelId]->RestoreEntitiesUsingThisModel(); m_Models[modelId] = nullptr; m_modelCount--;