Theme A→B→A switch leaves stale card-image handles — cards display wrong theme #19
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
File
solitaire_engine/src/theme/plugin.rslines 181–212Description
sync_card_image_set_with_active_themeonly updatesCardImageSetwhen it receivesAssetEvent::LoadedWithDependenciesorAssetEvent::Modifiedfor the active theme handle. When the user switches themes in the sequence A→B→A, Bevy does not re-fireLoadedWithDependenciesfor theme A because the asset is already resident in the cache. The function exits early, andCardImageSetretains 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)returnsSome). If so, callapply_theme_to_card_image_setimmediately rather than waiting for an asset event that will never fire.