SceneTree
Fix storing removed nodes to be skipped by the group calls
This commit is contained in:
parent
040f49ed6e
commit
471f2da9b6
@ -123,6 +123,9 @@ void SceneTree::tree_changed() {
|
|||||||
|
|
||||||
void SceneTree::node_added(Node *p_node) {
|
void SceneTree::node_added(Node *p_node) {
|
||||||
emit_signal(node_added_name, p_node);
|
emit_signal(node_added_name, p_node);
|
||||||
|
if (call_lock > 0) {
|
||||||
|
call_skip.erase(p_node->get_instance_id());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneTree::node_removed(Node *p_node) {
|
void SceneTree::node_removed(Node *p_node) {
|
||||||
@ -131,7 +134,7 @@ void SceneTree::node_removed(Node *p_node) {
|
|||||||
}
|
}
|
||||||
emit_signal(node_removed_name, p_node);
|
emit_signal(node_removed_name, p_node);
|
||||||
if (call_lock > 0) {
|
if (call_lock > 0) {
|
||||||
call_skip.insert(p_node);
|
call_skip.insert(p_node->get_instance_id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +264,7 @@ void SceneTree::call_group_flagsp(uint32_t p_call_flags, const StringName &p_gro
|
|||||||
|
|
||||||
if (p_call_flags & GROUP_CALL_REVERSE) {
|
if (p_call_flags & GROUP_CALL_REVERSE) {
|
||||||
for (int i = gr_node_count - 1; i >= 0; i--) {
|
for (int i = gr_node_count - 1; i >= 0; i--) {
|
||||||
if (call_lock && call_skip.has(gr_nodes[i])) {
|
if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +278,7 @@ void SceneTree::call_group_flagsp(uint32_t p_call_flags, const StringName &p_gro
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < gr_node_count; i++) {
|
for (int i = 0; i < gr_node_count; i++) {
|
||||||
if (call_lock && call_skip.has(gr_nodes[i])) {
|
if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +317,7 @@ void SceneTree::notify_group_flags(uint32_t p_call_flags, const StringName &p_gr
|
|||||||
|
|
||||||
if (p_call_flags & GROUP_CALL_REVERSE) {
|
if (p_call_flags & GROUP_CALL_REVERSE) {
|
||||||
for (int i = gr_node_count - 1; i >= 0; i--) {
|
for (int i = gr_node_count - 1; i >= 0; i--) {
|
||||||
if (call_lock && call_skip.has(gr_nodes[i])) {
|
if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +330,7 @@ void SceneTree::notify_group_flags(uint32_t p_call_flags, const StringName &p_gr
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < gr_node_count; i++) {
|
for (int i = 0; i < gr_node_count; i++) {
|
||||||
if (call_lock && call_skip.has(gr_nodes[i])) {
|
if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +368,7 @@ void SceneTree::set_group_flags(uint32_t p_call_flags, const StringName &p_group
|
|||||||
|
|
||||||
if (p_call_flags & GROUP_CALL_REVERSE) {
|
if (p_call_flags & GROUP_CALL_REVERSE) {
|
||||||
for (int i = gr_node_count - 1; i >= 0; i--) {
|
for (int i = gr_node_count - 1; i >= 0; i--) {
|
||||||
if (call_lock && call_skip.has(gr_nodes[i])) {
|
if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +381,7 @@ void SceneTree::set_group_flags(uint32_t p_call_flags, const StringName &p_group
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < gr_node_count; i++) {
|
for (int i = 0; i < gr_node_count; i++) {
|
||||||
if (call_lock && call_skip.has(gr_nodes[i])) {
|
if (call_lock && call_skip.has(gr_nodes[i]->get_instance_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,7 +857,7 @@ void SceneTree::_notify_group_pause(const StringName &p_group, int p_notificatio
|
|||||||
|
|
||||||
for (int i = 0; i < gr_node_count; i++) {
|
for (int i = 0; i < gr_node_count; i++) {
|
||||||
Node *n = gr_nodes[i];
|
Node *n = gr_nodes[i];
|
||||||
if (call_lock && call_skip.has(n)) {
|
if (call_lock && call_skip.has(n->get_instance_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,7 +907,7 @@ void SceneTree::_call_input_pause(const StringName &p_group, CallInputType p_cal
|
|||||||
}
|
}
|
||||||
|
|
||||||
Node *n = gr_nodes[i];
|
Node *n = gr_nodes[i];
|
||||||
if (call_lock && call_skip.has(n)) {
|
if (call_lock && call_skip.has(n->get_instance_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ private:
|
|||||||
|
|
||||||
// Safety for when a node is deleted while a group is being called.
|
// Safety for when a node is deleted while a group is being called.
|
||||||
int call_lock = 0;
|
int call_lock = 0;
|
||||||
HashSet<Node *> call_skip; // Skip erased nodes.
|
HashSet<ObjectID> call_skip; // Skip erased nodes. Store ID instead of pointer to avoid false positives when node is freed and a new node is allocated at the pointed address.
|
||||||
|
|
||||||
List<ObjectID> delete_queue;
|
List<ObjectID> delete_queue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user