Fix Project-Wide Signal Leaks in UI Components#269
Conversation
…_tree() - Added _exit_tree() to multiple UI scripts to disconnect signals from Autoloads and global nodes. - Implemented dictionary-based tracking for bound callables in `settings_panel.gd` to ensure they can be safely disconnected in Godot 4. - Updated `defeat_modal.gd` and `victory_modal.gd` to extend `_Modal` and call `super._exit_tree()`. - Ensured conflict warning timers in `remap_panel.gd` and block timers in `burden_modal.gd` are stored and disconnected. - Cleaned up orphaned `.gd.uid` files generated during the process. - Verified all changes with unit tests. Co-authored-by: niyazmft <9331133+niyazmft@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
…_tree() - Added _exit_tree() to multiple UI scripts to disconnect signals from Autoloads and global nodes. - Implemented dictionary-based tracking for bound callables in `settings_panel.gd` to ensure they can be safely disconnected in Godot 4. - Updated `defeat_modal.gd` and `victory_modal.gd` to extend `_Modal` and call `super._exit_tree()`. - Ensured conflict warning timers in `remap_panel.gd` and block timers in `burden_modal.gd` are stored and disconnected. - Formatted `settings_panel.gd` with `gdformat` to satisfy CI. - Cleaned up orphaned `.gd.uid` files. - Verified all changes with unit tests. Co-authored-by: niyazmft <9331133+niyazmft@users.noreply.github.com>
This PR addresses a project-wide signal leak issue where UI nodes were connecting to long-lived signals (Autoloads, SceneTree) in
_ready()but failing to disconnect in_exit_tree().Key changes:
settings_panel.gd, bound callables are now stored in a_bound_callablesdictionary. This is necessary because Godot 4 creates newCallableinstances on every.bind()call, making it impossible to disconnect without a reference to the specific instance used during connection.DefeatModalandVictoryModalwere updated to extend the base_Modalclass. This ensures consistent behavior and that parent signal cleanup (like the close button) is executed viasuper._exit_tree().SceneTreeTimerobjects used for UI feedback (like conflict warnings) are now stored in member variables and disconnected in_exit_tree()to prevent callbacks on freed nodes._exit_tree()totitle_screen.gd,settings_menu.gd,portrait_guard.gd,combat_hud.gd, and others to cover identified leaks..gd.uidfiles.Verified via GdUnit4 (174/174 tests passing).
Fixes #256
PR created automatically by Jules for task 12029236788707118407 started by @niyazmft