PhysicsEditor-Loaders
PhysicsEditor-Loaders copied to clipboard
crash when PhysicsShapeCache::removeAllShapes is called
PhysicsShapeCache code has some issue when BodyDef is removed
I think below definition has an issue
Map<std::string, BodyDef *> bodyDefs;
so i change this to
std::map<std::string, BodyDef *> bodyDefs;
and change safe delete function
bool PhysicsShapeCache::safeDeleteBodyDef(BodyDef *bodyDef)
{
for (auto fixturedate : bodyDef->fixtures)
{
for (auto polygon : fixturedate->polygons)
{
CC_SAFE_DELETE_ARRAY(polygon->vertices);
}
fixturedate->polygons.clear();
}
bodyDef->fixtures.clear();
bodyDef->release(); // insert release code here
return true;
}
it runs well