Skip to content

Fix crash because onConnected is called multiple times #576

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

Merged
merged 2 commits into from
Feb 6, 2017
Merged

Fix crash because onConnected is called multiple times #576

merged 2 commits into from
Feb 6, 2017

Conversation

SUPERCILEX
Copy link
Collaborator

Refactor mistake: I didn't notice that the old helper removed the listeners. I think that method is flawed though because if onConnectionFailed is called and later on onConnected also gets called, an IllegalStateException will still be thrown.

Signed-off-by: Alex Saveau <[email protected]>

(cherry picked from commit ba51fed)
Signed-off-by: Alex Saveau <[email protected]>
@samtstern
Copy link
Contributor

This does seem functionally the same as unregistering the listeners as we're basically just ignoring follow-up calls, but can you add some comments above the trySet{Foo} calls explaining why we need to use that style?

@SUPERCILEX
Copy link
Collaborator Author

@samtstern Will do! The other reason I wanted to use a trySet is because extenders of GoogleApiHelper might depend on onConnected being called each time the client connects, not just the first time.

@SUPERCILEX
Copy link
Collaborator Author

@samtstern Done.

@samtstern samtstern merged commit 6b0c1a6 into firebase:version-1.2.0-dev Feb 6, 2017
@SUPERCILEX SUPERCILEX deleted the task-already-complete branch February 6, 2017 23:03
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