Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualParadigm Shifter

Posted 27 April 2013 - 08:14 AM

Cgun (responsible for creating the bullet with new operator)

 

void CEntity::CGun::shoot(const b2Vec2& normal, const b2Vec2& pos, float rot)
{
//
   new CEntity::CBullet(m_World, normal, pos, rot);
//
}

 

Do you actually store the return value from new anywhere? Because otherwise you leak it and won't be able to delete it => no destructor will be called.

 

EDIT: Hard to edit posts with quote boxes in them, isn't it...


#1Paradigm Shifter

Posted 27 April 2013 - 08:13 AM

Cgun (responsible for creating the bullet with new operator)

 

void CEntity::CGun::shoot(const b2Vec2& normal, const b2Vec2& pos, float rot)
{
//
   new CEntity::CBullet(m_World, normal, pos, rot);
//
}
Do you actually store the return value from new anywhere? Because otherwise you leak it and won't be able to delete it => no destructor will be called.

PARTNERS