Ensure node's area tree signals are disconnected when clearing monitoring,
even if nodes are no longer in the tree.
This commit is contained in:
parent
2ba96f0dd9
commit
91bf9a91dd
1 changed files with 6 additions and 6 deletions
|
@ -222,6 +222,9 @@ void Area3D::_clear_monitoring() {
|
|||
}
|
||||
//ERR_CONTINUE(!node);
|
||||
|
||||
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));
|
||||
|
||||
if (!E->get().in_tree) {
|
||||
continue;
|
||||
}
|
||||
|
@ -231,9 +234,6 @@ void Area3D::_clear_monitoring() {
|
|||
}
|
||||
|
||||
emit_signal(SceneStringNames::get_singleton()->body_exited, node);
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,6 +251,9 @@ void Area3D::_clear_monitoring() {
|
|||
}
|
||||
//ERR_CONTINUE(!node);
|
||||
|
||||
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));
|
||||
|
||||
if (!E->get().in_tree) {
|
||||
continue;
|
||||
}
|
||||
|
@ -260,9 +263,6 @@ void Area3D::_clear_monitoring() {
|
|||
}
|
||||
|
||||
emit_signal(SceneStringNames::get_singleton()->area_exited, obj);
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue