(cheevos) [switch] fix crash on first load of game with achievements #16008
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes an issue where loading a game with achievements on the Switch version of RetroArch would crash if the game hadn't previously been loaded.
It turns out the problem isn't specific to the Switch, it's related to having Threaded Video on. If an achievement badge is not available when the popup is first queued, the rendering code will will attempt to load it again a few frames later. Since the rendering code runs on the video thread, the logic to better report an attempt to load images on a background thread (see #13247) throws an assertion exception and causes the application to terminate.
The Threaded Video code already marshals the image loading to the video thread, so I've updated the logic for detecting the loading of images on background threads to not run when Threaded Video is enabled. Additionally, I've updated the marshalling logic to not try to marshal if an image load does occur on the video thread.
Related Issues
https://discord.com/channels/184109094070779904/469974542299955210/1176267096041201704
https://discord.com/channels/310192285306454017/1182431038211899523/1182431038211899523
Related Pull Requests
n/a
Reviewers
[If possible @mention all the people that should review your pull request]