1
0

Fixed a memory leak in cPrefabPiecePool.

The pool pieces weren't freed upon pool destruction.
This commit is contained in:
madmaxoft
2014-05-28 16:33:10 +02:00
parent e06f786f11
commit d29b242674
2 changed files with 34 additions and 1 deletions

View File

@@ -26,6 +26,34 @@ cPrefabPiecePool::cPrefabPiecePool(
cPrefabPiecePool::~cPrefabPiecePool()
{
Clear();
}
void cPrefabPiecePool::Clear(void)
{
m_PiecesByConnector.clear();
for (cPieces::iterator itr = m_AllPieces.begin(), end = m_AllPieces.end(); itr != end; ++itr)
{
delete *itr;
}
m_AllPieces.clear();
for (cPieces::iterator itr = m_StartingPieces.begin(), end = m_StartingPieces.end(); itr != end; ++itr)
{
delete *itr;
}
m_StartingPieces.clear();
}
void cPrefabPiecePool::AddPieceDefs(const cPrefab::sDef * a_PieceDefs, size_t a_NumPieceDefs)
{
ASSERT(a_PieceDefs != NULL);