fix(android): calls re-saved during permission/activity result callbacks were being released #4281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A bug was observed (resolves #4277) where if permission was requested and the callback contained another permission/activity launch with a result, the app would crash claiming the savedCall was null.
What was happening was the call was originally saved for the first permission request, then during the callback the call would save again for the following activity result. The initial permission request would then try to cleanup after the callback was called and remove the saved call that was still being used by the waiting callback, resulting in it being null when the second callback returned.
Fix: I moved the cleanup of the savedCall before the callback is triggered so that if the same PluginCall is saved again, it won't be accidentally removed.