Apply Fix 2: evict ModelCache on game exit, flush pending callbacks

Adds evict_all() to ModelCache which sets _shutting_down before flushing
_pending with null callbacks, then clears _mem and _job_queue. This
prevents in-flight HTTP completions from firing into a freed game scene
and ensures each new game starts with a clean WASM heap. Called from
game_screen._exit_tree() after all signal disconnections.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-05-09 19:18:10 -04:00
co-authored by Claude Happy
parent 30a4211276
commit b926957329
2 changed files with 26 additions and 0 deletions
@@ -377,6 +377,7 @@ func _exit_tree() -> void:
_reset_unit_hover_glow()
Chat.set_bubble_host(null)
Chat.release_bubble_visibility(self)
ModelCache.evict_all()
# ── State → scene orchestration ───────────────────────────────────────────────