diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-08-11 10:37:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-11 10:37:51 +0200 |
commit | 0f23c4a3c0fb26bfe0c7b17a098c16337b6cbe6b (patch) | |
tree | 09a6d0c31a83c3dba9ab60cf483cb01f2ad6e0ba | |
parent | 7ed64327a9745a495197592402cf9d3ca7576205 (diff) | |
parent | fe1c3349e56c944abd3cc90c21ebc0b5ec95961b (diff) |
Merge pull request #10177 from bojidar-bg/9832-fix-infinite-loop
Fix freeze on close of game using 2D physics introduced by #9832
-rw-r--r-- | servers/physics/physics_server_sw.cpp | 4 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_sw.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index c40503c426..151fc44476 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -493,8 +493,8 @@ void PhysicsServerSW::body_set_space(RID p_body, RID p_space) { if (body->get_space() == space) return; //pointless - while (body->get_constraint_map().size()) { - RID self = body->get_constraint_map().front()->key()->get_self(); + for (Map<ConstraintSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) { + RID self = E->key()->get_self(); if (!self.is_valid()) continue; free(self); diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index debd38d43a..c698d614b8 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -548,8 +548,8 @@ void Physics2DServerSW::body_set_space(RID p_body, RID p_space) { if (body->get_space() == space) return; //pointless - while (body->get_constraint_map().size()) { - RID self = body->get_constraint_map().front()->key()->get_self(); + for (Map<Constraint2DSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) { + RID self = E->key()->get_self(); if (!self.is_valid()) continue; free(self); |