Merge pull request #10177 from bojidar-bg/9832-fix-infinite-loop

Fix freeze on close of game using 2D physics introduced by #9832
This commit is contained in:
Rémi Verschelde 2017-08-11 10:37:51 +02:00 committed by GitHub
commit 0f23c4a3c0
2 changed files with 4 additions and 4 deletions

View file

@ -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);

View file

@ -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);