mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
CharacterController: leak fix for btRigidBody and it's shape
This commit is contained in:
parent
e4f8a67e60
commit
0b7a5c4df8
2 changed files with 12 additions and 1 deletions
|
@ -72,6 +72,17 @@ CharacterController::CharacterController() {
|
||||||
_pendingFlags = PENDING_FLAG_UPDATE_SHAPE;
|
_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 {
|
bool CharacterController::needsRemoval() const {
|
||||||
return ((_pendingFlags & PENDING_FLAG_REMOVE_FROM_SIMULATION) == PENDING_FLAG_REMOVE_FROM_SIMULATION);
|
return ((_pendingFlags & PENDING_FLAG_REMOVE_FROM_SIMULATION) == PENDING_FLAG_REMOVE_FROM_SIMULATION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class btDynamicsWorld;
|
||||||
class CharacterController : public btCharacterControllerInterface {
|
class CharacterController : public btCharacterControllerInterface {
|
||||||
public:
|
public:
|
||||||
CharacterController();
|
CharacterController();
|
||||||
virtual ~CharacterController() {}
|
virtual ~CharacterController();
|
||||||
|
|
||||||
bool needsRemoval() const;
|
bool needsRemoval() const;
|
||||||
bool needsAddition() const;
|
bool needsAddition() const;
|
||||||
|
|
Loading…
Reference in a new issue