fix memory leak due to custom container not handling copy operator for recursive containers

This commit is contained in:
Erwin Coumans 2020-02-22 10:54:23 -08:00
parent 36738b7676
commit dc19da18ee

View File

@ -105,7 +105,17 @@ static inline btDbvtNode* buildTreeBottomUp(btAlignedObjectArray<btDbvtNode*>& l
} }
} }
leafNodes = newLeafNodes; leafNodes = newLeafNodes;
adj = newAdj; //this assignment leaks memory, the assignment doesn't do a deep copy, for now a manual copy
//adj = newAdj;
adj.clear();
adj.resize(newAdj.size());
for (int i = 0; i < newAdj.size(); i++)
{
for (int j = 0; j < newAdj[i].size(); j++)
{
adj[i].push_back(newAdj[i][j]);
}
}
N = leafNodes.size(); N = leafNodes.size();
} }
return leafNodes[0]; return leafNodes[0];