Merge pull request #4181 from ricardoquesada/delete_fixes

calls `delete[]` instead of `delete`
This commit is contained in:
Ricardo Quesada 2013-11-11 16:08:35 -08:00
commit 4b2eda3cdc
2 changed files with 7 additions and 5 deletions

View File

@ -37,8 +37,10 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher;
- (id) init
{
_acceleration = new cocos2d::Acceleration();
_motionManager = [[CMMotionManager alloc] init];
if( (self = [super init]) ) {
_acceleration = new cocos2d::Acceleration();
_motionManager = [[CMMotionManager alloc] init];
}
return self;
}

View File

@ -539,7 +539,7 @@ bool PhysicsShapePolygon::init(const Point* points, int count, const PhysicsMate
cpVect* vecs = new cpVect[count];
PhysicsHelper::points2cpvs(points, vecs, count);
cpShape* shape = cpPolyShapeNew(_info->getSharedBody(), count, vecs, PhysicsHelper::point2cpv(offset));
CC_SAFE_DELETE(vecs);
CC_SAFE_DELETE_ARRAY(vecs);
CC_BREAK_IF(shape == nullptr);
@ -563,7 +563,7 @@ float PhysicsShapePolygon::calculateArea(const Point* points, int count)
cpVect* vecs = new cpVect[count];
PhysicsHelper::points2cpvs(points, vecs, count);
float area = PhysicsHelper::cpfloat2float(cpAreaForPoly(count, vecs));
CC_SAFE_DELETE(vecs);
CC_SAFE_DELETE_ARRAY(vecs);
return area;
}
@ -574,7 +574,7 @@ float PhysicsShapePolygon::calculateMoment(float mass, const Point* points, int
PhysicsHelper::points2cpvs(points, vecs, count);
float moment = mass == PHYSICS_INFINITY ? PHYSICS_INFINITY
: PhysicsHelper::cpfloat2float(cpMomentForPoly(mass, count, vecs, PhysicsHelper::point2cpv(offset)));
CC_SAFE_DELETE(vecs);
CC_SAFE_DELETE_ARRAY(vecs);
return moment;
}