Skip to content

Commit

Permalink
Fix CResourceModelStreamer::FullyReleaseModel crash (#3746)
Browse files Browse the repository at this point in the history
* Fix crash

* Revert "Fix crash"

This reverts commit 7c65f86.

* Fix crash

* Fix typo
  • Loading branch information
TheNormalnij authored Sep 27, 2024
1 parent d01df35 commit f95bba0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions Client/mods/deathmatch/logic/CClientModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions Client/mods/deathmatch/logic/CClientModelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ bool CClientModelManager::Remove(const std::shared_ptr<CClientModel>& pModel)
int modelId = pModel->GetModelID();
if (m_Models[modelId] != nullptr)
{
CResource* parentResource = m_Models[modelId]->GetParentResource();
if (parentResource)
parentResource->GetResourceModelStreamer()->FullyReleaseModel(modelId);
m_Models[modelId]->RestoreEntitiesUsingThisModel();
m_Models[modelId] = nullptr;
m_modelCount--;
Expand Down

0 comments on commit f95bba0

Please sign in to comment.