Merge pull request #42513 from madmiraal/fix-42494
Remove area or body from map before emitting signals.
This commit is contained in:
commit
9b1c9cef17
2 changed files with 16 additions and 40 deletions
|
@ -180,26 +180,20 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i
|
||||||
E->get().shapes.erase(ShapePair(p_body_shape, p_area_shape));
|
E->get().shapes.erase(ShapePair(p_body_shape, p_area_shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool eraseit = false;
|
bool in_tree = E->get().in_tree;
|
||||||
|
|
||||||
if (E->get().rc == 0) {
|
if (E->get().rc == 0) {
|
||||||
|
body_map.erase(E);
|
||||||
if (node) {
|
if (node) {
|
||||||
node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_body_enter_tree));
|
node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_body_enter_tree));
|
||||||
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_body_exit_tree));
|
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_body_exit_tree));
|
||||||
if (E->get().in_tree) {
|
if (in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_exited, obj);
|
emit_signal(SceneStringNames::get_singleton()->body_exited, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eraseit = true;
|
|
||||||
}
|
}
|
||||||
if (!node || E->get().in_tree) {
|
if (!node || in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_shape_exited, objid, obj, p_body_shape, p_area_shape);
|
emit_signal(SceneStringNames::get_singleton()->body_shape_exited, objid, obj, p_body_shape, p_area_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eraseit) {
|
|
||||||
body_map.erase(E);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
locked = false;
|
locked = false;
|
||||||
|
@ -278,26 +272,20 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i
|
||||||
E->get().shapes.erase(AreaShapePair(p_area_shape, p_self_shape));
|
E->get().shapes.erase(AreaShapePair(p_area_shape, p_self_shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool eraseit = false;
|
bool in_tree = E->get().in_tree;
|
||||||
|
|
||||||
if (E->get().rc == 0) {
|
if (E->get().rc == 0) {
|
||||||
|
area_map.erase(E);
|
||||||
if (node) {
|
if (node) {
|
||||||
node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_area_enter_tree));
|
node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_area_enter_tree));
|
||||||
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_area_exit_tree));
|
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_area_exit_tree));
|
||||||
if (E->get().in_tree) {
|
if (in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->area_exited, obj);
|
emit_signal(SceneStringNames::get_singleton()->area_exited, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eraseit = true;
|
|
||||||
}
|
}
|
||||||
if (!node || E->get().in_tree) {
|
if (!node || in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->area_shape_exited, objid, obj, p_area_shape, p_self_shape);
|
emit_signal(SceneStringNames::get_singleton()->area_shape_exited, objid, obj, p_area_shape, p_self_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eraseit) {
|
|
||||||
area_map.erase(E);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
locked = false;
|
locked = false;
|
||||||
|
|
|
@ -180,26 +180,20 @@ void Area3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i
|
||||||
E->get().shapes.erase(ShapePair(p_body_shape, p_area_shape));
|
E->get().shapes.erase(ShapePair(p_body_shape, p_area_shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool eraseit = false;
|
bool in_tree = E->get().in_tree;
|
||||||
|
|
||||||
if (E->get().rc == 0) {
|
if (E->get().rc == 0) {
|
||||||
|
body_map.erase(E);
|
||||||
if (node) {
|
if (node) {
|
||||||
node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_body_enter_tree));
|
node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_body_enter_tree));
|
||||||
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_body_exit_tree));
|
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_body_exit_tree));
|
||||||
if (E->get().in_tree) {
|
if (in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_exited, obj);
|
emit_signal(SceneStringNames::get_singleton()->body_exited, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eraseit = true;
|
|
||||||
}
|
}
|
||||||
if (node && E->get().in_tree) {
|
if (node && in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_shape_exited, objid, obj, p_body_shape, p_area_shape);
|
emit_signal(SceneStringNames::get_singleton()->body_shape_exited, objid, obj, p_body_shape, p_area_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eraseit) {
|
|
||||||
body_map.erase(E);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
locked = false;
|
locked = false;
|
||||||
|
@ -366,26 +360,20 @@ void Area3D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i
|
||||||
E->get().shapes.erase(AreaShapePair(p_area_shape, p_self_shape));
|
E->get().shapes.erase(AreaShapePair(p_area_shape, p_self_shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool eraseit = false;
|
bool in_tree = E->get().in_tree;
|
||||||
|
|
||||||
if (E->get().rc == 0) {
|
if (E->get().rc == 0) {
|
||||||
|
area_map.erase(E);
|
||||||
if (node) {
|
if (node) {
|
||||||
node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_area_enter_tree));
|
node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area3D::_area_enter_tree));
|
||||||
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_area_exit_tree));
|
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area3D::_area_exit_tree));
|
||||||
if (E->get().in_tree) {
|
if (in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->area_exited, obj);
|
emit_signal(SceneStringNames::get_singleton()->area_exited, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eraseit = true;
|
|
||||||
}
|
}
|
||||||
if (!node || E->get().in_tree) {
|
if (!node || in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->area_shape_exited, objid, obj, p_area_shape, p_self_shape);
|
emit_signal(SceneStringNames::get_singleton()->area_shape_exited, objid, obj, p_area_shape, p_self_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eraseit) {
|
|
||||||
area_map.erase(E);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
locked = false;
|
locked = false;
|
||||||
|
|
Loading…
Reference in a new issue