fix: double-free due to calling super-destructor

This commit is contained in:
maelstrom 2025-01-23 22:38:24 +01:00
parent b10abd3800
commit 9b51d85056

View file

@ -24,8 +24,8 @@ Part::Part(PartConstructParams params): Instance(&TYPE_), position(params.positi
// This feels wrong. Get access to PhysicsWorld somehow else? Part will need access to this often though, most likely...
extern rp::PhysicsWorld* world;
Part::~Part() {
world->destroyRigidBody(rigidBody);
Instance::~Instance();
if (this->rigidBody)
world->destroyRigidBody(rigidBody);
}