Theme A→B→A switch leaves stale card-image handles — cards display wrong theme #19

Closed
opened 2026-05-19 18:43:05 +00:00 by funman300 · 0 comments
Owner

File

solitaire_engine/src/theme/plugin.rs lines 181–212

Description

sync_card_image_set_with_active_theme only updates CardImageSet when it receives AssetEvent::LoadedWithDependencies or AssetEvent::Modified for the active theme handle. When the user switches themes in the sequence A→B→A, Bevy does not re-fire LoadedWithDependencies for theme A because the asset is already resident in the cache. The function exits early, and CardImageSet retains theme B's face handles. All 52 card sprites continue to display theme B faces.

Fix

After resolving the active theme handle in react_to_settings_theme_change, check if the asset is already loaded (themes.get(&active.0) returns Some). If so, call apply_theme_to_card_image_set immediately rather than waiting for an asset event that will never fire.

## File `solitaire_engine/src/theme/plugin.rs` lines 181–212 ## Description `sync_card_image_set_with_active_theme` only updates `CardImageSet` when it receives `AssetEvent::LoadedWithDependencies` or `AssetEvent::Modified` for the active theme handle. When the user switches themes in the sequence A→B→A, Bevy does **not** re-fire `LoadedWithDependencies` for theme A because the asset is already resident in the cache. The function exits early, and `CardImageSet` retains theme B's face handles. All 52 card sprites continue to display theme B faces. ## Fix After resolving the active theme handle in `react_to_settings_theme_change`, check if the asset is already loaded (`themes.get(&active.0)` returns `Some`). If so, call `apply_theme_to_card_image_set` immediately rather than waiting for an asset event that will never fire.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#19