-
Notifications
You must be signed in to change notification settings - Fork 517
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
fix: unable to quit application with application exit or in-game exit button [MTT-7003] #863
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple & Clean
On the open question: the refactoring looks good too. Based on the snippet it doesn't even seem like the current implementation uses the results, it just awaits for the call. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved! And nice catch for the lobby reset! I'll include that change in PR #860
86b4277
Description
This PR fixes the issue of not being able to quit the application after a game session.
This was due to not unsubscribing to the Application.wantsToQuit callback when attempting to quit. The callback would fire on a client when quitting, and in the attempt of quitting, would invoke
m_LobbyServiceFacade.EndTracking()
, that call would return an error, the application would invoke Application.Quit, and the loop would continue, stuck in a loop.This PR simply unsubscribes to the Application.wantsToQuit callback when attempting to quit, invoking the cleanup coroutine only once.
Issue Number(s)
MTT-7003
How To Test
Contribution checklist
Open Question
This is more of a design question, but I'm noticing that on certain async Lobby requests, namely ones for deletion and leaving, the internal Lobby reference isn't cleared if the operation fails. This can happen if a client has been removed from a Lobby -> they try to leave that Lobby -> the Lobby doesn't exist -> async operation fails -> ResetLobby() is not invoked because of this.
So then the client is technically not part of a Lobby, but LobbyServiceFacade.CurrentUnityLobby is still not null. This can result in various attempts to leave a lobby when the application is quit, since LobbyServiceFacade.CurrentUnityLobby is not cleared.
I propose to refactor LobbyServiceFacade.LeaveLobbyAsync from:
to something like:
so that the Lobby is cleared regardless of async operation result.
Let me know your thoughts on this proposal. It would similarly be applied to the deletion async operation.