Fix crash when PhysicsMaterial asset is reloaded in editor
This commit is contained in:
@@ -4474,6 +4474,16 @@ void PhysicsBackend::DestroyController(void* controller)
|
||||
controllerPhysX->release();
|
||||
}
|
||||
|
||||
void PhysicsBackend::DestroyMaterial(void* material)
|
||||
{
|
||||
ASSERT_LOW_LAYER(material);
|
||||
auto materialPhysX = (PxMaterial*)material;
|
||||
materialPhysX->userData = nullptr;
|
||||
FlushLocker.Lock();
|
||||
DeleteObjects.Add(materialPhysX);
|
||||
FlushLocker.Unlock();
|
||||
}
|
||||
|
||||
void PhysicsBackend::DestroyObject(void* object)
|
||||
{
|
||||
ASSERT_LOW_LAYER(object);
|
||||
|
||||
@@ -81,7 +81,7 @@ void PhysicsSettings::Deserialize(DeserializeStream& stream, ISerializeModifier*
|
||||
PhysicalMaterial::~PhysicalMaterial()
|
||||
{
|
||||
if (_material)
|
||||
PhysicsBackend::DestroyObject(_material);
|
||||
PhysicsBackend::DestroyMaterial(_material);
|
||||
}
|
||||
|
||||
bool PhysicsService::Init()
|
||||
|
||||
@@ -314,6 +314,7 @@ public:
|
||||
static void DestroyShape(void* shape);
|
||||
static void DestroyJoint(void* joint);
|
||||
static void DestroyController(void* controller);
|
||||
static void DestroyMaterial(void* material);
|
||||
static void DestroyObject(void* object);
|
||||
static void RemoveCollider(PhysicsColliderActor* collider);
|
||||
static void RemoveJoint(Joint* joint);
|
||||
|
||||
@@ -865,6 +865,10 @@ void PhysicsBackend::DestroyController(void* controller)
|
||||
{
|
||||
}
|
||||
|
||||
void PhysicsBackend::DestroyMaterial(void* material)
|
||||
{
|
||||
}
|
||||
|
||||
void PhysicsBackend::DestroyObject(void* object)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user