-
-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Open
Labels
Milestone
Description
Godot version
3.5.2
System information
Windows 10 x64
Issue description
I found out that you can delete a node in a specific situation that should be blocked. This causes invalid node to stay in the scene tree, which is basically a ticking bomb:

When the parent node is being freed, the broken node causes hard crash with very obscure stack trace (assuming you use C++ debugger, otherwise there is no error log). This can happen e.g. when changing scenes and also leads to random bugs like null during get_children() iteration.
The issue does not happen in 4.x, as this situation is handled and results in an error.
Steps to reproduce
- Attach this script to a node
extends Node
func _ready() -> void:
var ui = Node.new()
add_child(ui)
var menu = Node.new()
ui.add_child(menu)
var interface = Node.new()
ui.add_child(interface)
interface.connect("tree_exiting", menu.get_parent(), "remove_child", [menu])
get_tree().create_timer(0.5).connect("timeout", interface, "queue_free") # invalid node here (and cow_data error)
get_tree().create_timer(1).connect("timeout", self, "queue_free") # crash- Run
Minimal reproduction project
N/A
Reactions are currently unavailable