mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 01:03:59 +02:00
Merge pull request #7681 from hyperlogic/tony/character-controller-leak-fix
Memory leak on exit for CharacterController
This commit is contained in:
commit
d16750c590
2 changed files with 12 additions and 1 deletions
|
@ -72,6 +72,17 @@ CharacterController::CharacterController() {
|
|||
_pendingFlags = PENDING_FLAG_UPDATE_SHAPE;
|
||||
}
|
||||
|
||||
CharacterController::~CharacterController() {
|
||||
if (_rigidBody) {
|
||||
btCollisionShape* shape = _rigidBody->getCollisionShape();
|
||||
if (shape) {
|
||||
delete shape;
|
||||
}
|
||||
delete _rigidBody;
|
||||
_rigidBody = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool CharacterController::needsRemoval() const {
|
||||
return ((_pendingFlags & PENDING_FLAG_REMOVE_FROM_SIMULATION) == PENDING_FLAG_REMOVE_FROM_SIMULATION);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class btDynamicsWorld;
|
|||
class CharacterController : public btCharacterControllerInterface {
|
||||
public:
|
||||
CharacterController();
|
||||
virtual ~CharacterController() {}
|
||||
virtual ~CharacterController();
|
||||
|
||||
bool needsRemoval() const;
|
||||
bool needsAddition() const;
|
||||
|
|
Loading…
Reference in a new issue