Skip to content
Permalink
Browse files

Fix #1182 (Crash when streaming in custom IDs created with engineRequ…

…estModel)
  • Loading branch information
ccw808 committed Dec 9, 2019
1 parent 7aa58df commit 49d1bc001fa3bebc0e9c20409900359eff6205f2
Showing with 11 additions and 7 deletions.
  1. +11 −7 Client/mods/deathmatch/logic/CClientModelRequestManager.cpp
@@ -265,18 +265,22 @@ void CClientModelRequestManager::DoPulse()
// Is it loaded?
if (pEntry->pModel->IsLoaded())
{
// Copy then remove from the list because the request is complete and we don't want it modified in Request()
const SClientModelRequest entryCopy = *pEntry;
delete pEntry;
m_Requests.erase(iter);

// Make sure custom things are replaced
pEntry->pModel->MakeCustomModel();
entryCopy.pModel->MakeCustomModel();

// Call the callback
pEntry->pEntity->ModelRequestCallback(pEntry->pModel);
// Create ped/object/vehicle using the loaded model (this can eventually trigger script events)
entryCopy.pEntity->ModelRequestCallback(entryCopy.pModel);

// Unreference us from the model (callback should've added a reference!)
pEntry->pModel->RemoveRef();
entryCopy.pModel->RemoveRef();

// Delete the request entry. Remove from the list and continue from after it
delete *iter;
iter = m_Requests.erase(iter);
// Restart loop because m_Requests may have been changed
iter = m_Requests.begin();
}
else
{

0 comments on commit 49d1bc0

Please sign in to comment.
You can’t perform that action at this time.