mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-20 15:13:45 +00:00
Fix use-after-delete
This commit is contained in:
parent
68b5e7b517
commit
dc780ddcae
1 changed files with 3 additions and 2 deletions
|
|
@ -263,8 +263,6 @@ void MaterialList::clearMatInstList()
|
|||
if (mMatInstList[i])
|
||||
{
|
||||
BaseMatInstance* current = mMatInstList[i];
|
||||
delete current;
|
||||
mMatInstList[i] = NULL;
|
||||
|
||||
// ok, since ts material lists can remap difference indexes to the same object
|
||||
// we need to make sure that we don't delete the same memory twice. walk the
|
||||
|
|
@ -272,6 +270,9 @@ void MaterialList::clearMatInstList()
|
|||
for (U32 j=0; j<mMatInstList.size(); j++)
|
||||
if (mMatInstList[j] == current)
|
||||
mMatInstList[j] = NULL;
|
||||
|
||||
mMatInstList[i] = NULL;
|
||||
delete current;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue