Skip to content

Fix login scene cleanup ordering#313

Open
itayalroy wants to merge 1 commit intosven-n:mainfrom
itayalroy:fix_login_scene_race
Open

Fix login scene cleanup ordering#313
itayalroy wants to merge 1 commit intosven-n:mainfrom
itayalroy:fix_login_scene_race

Conversation

@itayalroy
Copy link
Copy Markdown

Previously, the client requested the new account's character list first and then cleaned up the old login scene. If the server responded quickly, the new characters could be created and then immediately cleared by the late cleanup, leaving the character selection screen empty.

Reproduce against a local OpenMU server: log into one account, return to server selection, then log into a different account and the character selection screen appears empty.

Previously, the client requested the new account's character
list first and then cleaned up the old login scene. If the
server responded quickly, the new characters could be created
and then immediately cleared by the late cleanup, leaving the
character selection screen empty.

Reproduce against a local OpenMU server: log into one account,
return to server selection, then log into a different
account and the character selection screen appears empty.
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a race condition occurring during the login flow. By reordering the cleanup of the login scene to happen prior to requesting the character list, the application ensures that incoming server responses are not prematurely discarded, thereby fixing an issue where the character selection screen would appear empty.

Highlights

  • Cleanup Order Adjustment: Moved the invocation of ReleaseLogoSceneData to occur before the character list request is sent to the server.
  • Race Condition Prevention: Ensures that login scene data is fully cleared before new character data arrives, preventing the new data from being inadvertently wiped by late cleanup operations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reorders the scene teardown process in LoginScene.cpp to prevent a race condition where a fast server reply could be cleared prematurely. However, the removal of ClearCharacters() may lead to stale character data being displayed when switching accounts; it is recommended to re-introduce the clear call to ensure a clean state.


// Tear down the login scene data before asking the server for the
// account characters, otherwise a fast reply can be cleared again.
ReleaseLogoSceneData();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While moving ReleaseLogoSceneData() to fix the race condition is correct, completely removing ClearCharacters() might introduce a new bug. If a player logs out from an account and logs into a different one with fewer characters, the characters from the previous account might still be displayed if they are not cleared.

It seems ClearCharacters() is necessary to ensure a clean state for the new account's character list. I'd recommend re-introducing it here, before the SendRequestCharacterList call.

Suggested change
ReleaseLogoSceneData();
ReleaseLogoSceneData();
ClearCharacters();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReleaseLogoSceneData already calls ClearCharacters so no need to call it twice

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.

1 participant