diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-07-07 08:07:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 08:07:20 +0200 |
commit | f60cb2931c74d68b19b18c15442c1043d2ebb884 (patch) | |
tree | c2079bc6b12a6e0f76c926d4312e3be1a6a1bbe4 | |
parent | 09e12ba9b46934c32ffc9e178b5c6f0348de809f (diff) | |
parent | 3dc1a1dbfb0b6d7f3b073dc935018bf4694b62a3 (diff) |
Merge pull request #62784 from Chaosus/fix_mesh_crash
Prevent possible crash when creating or deleting a mesh with armature
-rw-r--r-- | drivers/gles3/storage/mesh_storage.cpp | 2 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp index b042e53116..88b81805fa 100644 --- a/drivers/gles3/storage/mesh_storage.cpp +++ b/drivers/gles3/storage/mesh_storage.cpp @@ -64,6 +64,8 @@ void MeshStorage::mesh_free(RID p_rid) { mesh_clear(p_rid); mesh_set_shadow_mesh(p_rid, RID()); Mesh *mesh = mesh_owner.get_or_null(p_rid); + ERR_FAIL_COND(!mesh); + mesh->dependency.deleted_notify(p_rid); if (mesh->instances.size()) { ERR_PRINT("deleting mesh with active instances"); diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp index c97b75ba14..3875eb6615 100644 --- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp @@ -210,6 +210,8 @@ void MeshStorage::mesh_free(RID p_rid) { mesh_clear(p_rid); mesh_set_shadow_mesh(p_rid, RID()); Mesh *mesh = mesh_owner.get_or_null(p_rid); + ERR_FAIL_COND(!mesh); + mesh->dependency.deleted_notify(p_rid); if (mesh->instances.size()) { ERR_PRINT("deleting mesh with active instances"); |