You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Fix freeze on close of game using 2D physics introduced by #9832
Additionally, port the fix to 3D physics, just in case
This commit is contained in:
@@ -493,8 +493,8 @@ void PhysicsServerSW::body_set_space(RID p_body, RID p_space) {
|
|||||||
if (body->get_space() == space)
|
if (body->get_space() == space)
|
||||||
return; //pointless
|
return; //pointless
|
||||||
|
|
||||||
while (body->get_constraint_map().size()) {
|
for (Map<ConstraintSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) {
|
||||||
RID self = body->get_constraint_map().front()->key()->get_self();
|
RID self = E->key()->get_self();
|
||||||
if (!self.is_valid())
|
if (!self.is_valid())
|
||||||
continue;
|
continue;
|
||||||
free(self);
|
free(self);
|
||||||
|
|||||||
@@ -548,8 +548,8 @@ void Physics2DServerSW::body_set_space(RID p_body, RID p_space) {
|
|||||||
if (body->get_space() == space)
|
if (body->get_space() == space)
|
||||||
return; //pointless
|
return; //pointless
|
||||||
|
|
||||||
while (body->get_constraint_map().size()) {
|
for (Map<Constraint2DSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) {
|
||||||
RID self = body->get_constraint_map().front()->key()->get_self();
|
RID self = E->key()->get_self();
|
||||||
if (!self.is_valid())
|
if (!self.is_valid())
|
||||||
continue;
|
continue;
|
||||||
free(self);
|
free(self);
|
||||||
|
|||||||
Reference in New Issue
Block a user