1
0
forked from 0ad/0ad

Fixed heap corruption, hopefully correctly

This was SVN commit r793.
This commit is contained in:
Ykkrosh 2004-07-21 12:29:32 +00:00
parent 1343de75d8
commit 4a9262afb6
2 changed files with 4 additions and 8 deletions

View File

@ -101,25 +101,21 @@ void CEntity::loadBase()
void CEntity::kill()
{
g_Selection.removeAll( this );
if( m_bounds ) delete( m_bounds );
m_actor = NULL;
m_bounds = NULL;
m_extant = false;
m_extant_mirror = false;
return; // TODO: Help! Wierd heap corruption error I've not been able to fix
// but stopping entities being deallocated supresses it.
// Have a hunch it's to do with deallocating actors that haven't
// had renderdata set up yet.
if( m_actor )
{
g_UnitMan.RemoveUnit( m_actor );
delete( m_actor );
m_actor = NULL;
}
me = HEntity();
me = HEntity(); // will deallocate the entity, assuming nobody else has a reference to it
}
bool isWaypoint( CEntity* e )

View File

@ -106,7 +106,7 @@ void CEntityManager::destroy( u16 handle )
{
m_reaper.push_back( m_entities[handle].m_entity );
m_entities[handle].m_entity->me.m_handle = INVALID_HANDLE;
delete( m_entities[handle].m_entity );
//delete( m_entities[handle].m_entity ); // PT: Don't delete here, because the reaper will kill it later
}
bool CEntityManager::m_extant = false;