Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add another check for game being unloaded before calling load callback #368

Merged

Conversation

Jamiras
Copy link
Member

@Jamiras Jamiras commented Sep 3, 2024

@Jamiras Jamiras added this to the 11.6.0 milestone Sep 3, 2024
@CasualPokePlayer
Copy link
Contributor

I'm not quite satisfied by this. This doesn't solve the underlying race condition occurring. rc_client_free_game needs to occur while there is no chance for another thread to interact with the client's rc_client_game_info_t. Or more frankly, you should not be reading client->game outside of the client->state.mutex lock. That, or you need to ensure client->game wouldn't suddenly be set to NULL and free'd while another thread is using it via some other mechanism.

@Jamiras
Copy link
Member Author

Jamiras commented Sep 4, 2024

Made another pass. The client->state.load object is no longer detached at the start of rc_client_activate_game. If client->state.load->game is client->game, rc_client_unload_game will no longer free it, allowing rc_client_activate_game to do so after calling its callback.

@Jamiras Jamiras merged commit 3c7f16d into RetroAchievements:develop Sep 14, 2024
7 checks passed
@Jamiras Jamiras deleted the bugfix/unload_during_activate branch September 14, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants