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:
@@ -917,6 +917,7 @@ func _elapsed_simulated_text(minutes: int) -> String:
|
||||
|
||||
|
||||
func _duration_text(seconds: int) -> String:
|
||||
@warning_ignore("integer_division")
|
||||
return "%02d:%02d" % [seconds / 60, seconds % 60]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user