Fix stale-node crash in UI sound auto-wiring
node_added already fires once per node as it enters the tree (including every descendant of a newly-added subtree), so the recursive call_deferred in _on_node_added was redundant and held a raw Node reference across a frame boundary. If that node got freed before the deferred call fired (e.g. a container torn down and rebuilt the same frame), the engine's message queue couldn't marshal the argument and threw "Cannot convert argument 1 from Object to Object". Wiring synchronously removes the window entirely. Also silences the intentional integer division in _duration_text, matching the same annotation already applied to _elapsed_simulated_text.
This commit is contained in:
@@ -88,7 +88,8 @@ func _next_available_player() -> AudioStreamPlayer:
|
||||
|
||||
|
||||
func _on_node_added(node: Node) -> void:
|
||||
call_deferred("_wire_node", node)
|
||||
if node is Button:
|
||||
_wire_button(node)
|
||||
|
||||
|
||||
func _wire_existing_buttons() -> void:
|
||||
|
||||
Reference in New Issue
Block a user