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

Fixes race condition caused by billing client dereference #1388

Merged

Conversation

andresesfm
Copy link
Collaborator

@andresesfm andresesfm commented Jun 22, 2021

There are many tickets related to duplicate events and null pointer exceptions. They were caused by the implementation that constantly created a new listener. In this PR I:

  1. Standardize Android calls by checking for connection to be initialized before calling any of the other methods
  2. Check for duplicate calls to initConnection that could cause a race condition
  3. Add documentation to the proper way to initialize/tear down the connection

@andresesfm
Copy link
Collaborator Author

This needs more work. Reading the documentation for the iap library v3, I realized that we should guard the existence of the client instead of creating a new one when needed. This was likely implemented as such catering to older versions of t he SDK

@hyochan
Copy link
Member

hyochan commented Jun 29, 2021

@andresesfm Is this ready for review?

@lc3t35
Copy link

lc3t35 commented Jun 30, 2021

Hi, thank you @andresesfm nice catch ! I'm stuck on Android for all the tests related to purchasing (ios pass the tests (highfive) ) ;) @hyochan Hope you can review and validate the PR as soon as possible. Thank you for your time !

Copy link
Member

@hyochan hyochan left a comment

Choose a reason for hiding this comment

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

Updated small fixes in docs.

Thanks for the contribution again 🙌

@hyochan hyochan merged commit 1409b8f into dooboolab-community:master Jul 2, 2021
@andresesfm andresesfm deleted the fixes_npe_race_condition branch July 2, 2021 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Related to android 🛠 bugfix All kinds of bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants