Files
skelly/scenes/game/gameplays/Match3DebugMenu.gd
Vladimir nett00n Budylnikov 742e4251fb Fix critical memory leaks, race conditions, and improve code quality
- Fix memory leaks in match3_gameplay.gd with proper queue_free() usage
  - Add comprehensive error handling and fallback mechanisms to SettingsManager
  - Resolve scene loading race conditions in GameManager with state protection
  - Remove problematic static variables from tile.gd, replace with instance-based approach
  - Consolidate duplicate debug menu classes into shared DebugMenuBase
  - Add input validation across all user input paths for security and stability
2025-09-25 00:47:08 +04:00

37 lines
1.3 KiB
GDScript

extends DebugMenuBase
func _ready():
# Set specific configuration for Match3DebugMenu
log_category = "Match3"
target_script_path = "res://scenes/game/gameplays/match3_gameplay.gd"
# Call parent's _ready
super._ready()
DebugManager.log_debug("Match3DebugMenu _ready() completed", log_category)
# Initialize with current debug state if enabled
var current_debug_state = DebugManager.is_debug_enabled()
if current_debug_state:
_on_debug_toggled(true)
func _find_target_scene():
# Debug menu is now: Match3 -> UILayer -> Match3DebugMenu
# So we need to go up two levels: get_parent() = UILayer, get_parent().get_parent() = Match3
var ui_layer = get_parent()
if ui_layer and ui_layer is CanvasLayer:
var potential_match3 = ui_layer.get_parent()
if potential_match3 and potential_match3.get_script():
var script_path = potential_match3.get_script().resource_path
if script_path == target_script_path:
match3_scene = potential_match3
DebugManager.log_debug("Found match3 scene: " + match3_scene.name + " at path: " + str(match3_scene.get_path()), log_category)
_update_ui_from_scene()
_stop_search_timer()
return
# If we couldn't find it, clear the reference and continue searching
match3_scene = null
DebugManager.log_error("Could not find match3_gameplay scene", log_category)
_start_search_timer()