Skip to content

Commit

Permalink
Merge pull request godotengine#84832 from alesliehughes/fix_use_after…
Browse files Browse the repository at this point in the history
…_free

Fix VisualShader connection use after free.
  • Loading branch information
akien-mga committed Nov 13, 2023
2 parents 8d731b1 + a30dc67 commit 8b705af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scene/resources/visual_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -963,13 +963,13 @@ void VisualShader::remove_node(Type p_type, int p_id) {
for (List<Connection>::Element *E = g->connections.front(); E;) {
List<Connection>::Element *N = E->next();
if (E->get().from_node == p_id || E->get().to_node == p_id) {
g->connections.erase(E);
if (E->get().from_node == p_id) {
g->nodes[E->get().to_node].prev_connected_nodes.erase(p_id);
g->nodes[E->get().to_node].node->set_input_port_connected(E->get().to_port, false);
} else if (E->get().to_node == p_id) {
g->nodes[E->get().from_node].next_connected_nodes.erase(p_id);
}
g->connections.erase(E);
}
E = N;
}
Expand Down

0 comments on commit 8b705af

Please sign in to comment.