Skip to content

Commit f95bba0

Browse files
authored
Fix CResourceModelStreamer::FullyReleaseModel crash (#3746)
* Fix crash * Revert "Fix crash" This reverts commit 7c65f86. * Fix crash * Fix typo
1 parent d01df35 commit f95bba0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Client/mods/deathmatch/logic/CClientModel.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ bool CClientModel::Deallocate()
8484
if (!m_bAllocatedByUs)
8585
return false;
8686

87-
if (m_pParentResource)
88-
m_pParentResource->GetResourceModelStreamer()->FullyReleaseModel(m_iModelID);
89-
9087
SetParentResource(nullptr);
9188

9289
CModelInfo* pModelInfo = g_pGame->GetModelInfo(m_iModelID, true);

Client/mods/deathmatch/logic/CClientModelManager.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ bool CClientModelManager::Remove(const std::shared_ptr<CClientModel>& pModel)
4949
int modelId = pModel->GetModelID();
5050
if (m_Models[modelId] != nullptr)
5151
{
52+
CResource* parentResource = m_Models[modelId]->GetParentResource();
53+
if (parentResource)
54+
parentResource->GetResourceModelStreamer()->FullyReleaseModel(modelId);
5255
m_Models[modelId]->RestoreEntitiesUsingThisModel();
5356
m_Models[modelId] = nullptr;
5457
m_modelCount--;

0 commit comments

Comments
 (0)