Skip to content

Guard against Banner/Interstitial use of nullptr callbacks #744

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
Nov 18, 2021

Conversation

DellaBitta
Copy link
Contributor

@DellaBitta DellaBitta commented Nov 10, 2021

Description

Provide details of the change, and generalize the change in the PR title above.

Check to see if Interstitial and BannerView callback pointers have been nullified before invoking them in Java.


Testing

Describe how you've tested these changes. Link any manually triggered Integration tests or CPP binary SDK Packaging Github Action workflows, if applicable.

Ran iTests on Android phone.
iTest Run


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

@google-cla google-cla bot added the cla: yes label Nov 10, 2021
@DellaBitta DellaBitta changed the base branch from main to feature/admob_2021 November 10, 2021 21:20
@DellaBitta DellaBitta changed the title Feature/admob 2021 stability Guard against Banner/Interstitial use of nullptr callbacks Nov 10, 2021
@@ -177,7 +177,6 @@ public void destroy(final long callbackDataPtr) {
completeBannerViewFutureCallback(callbackDataPtr,
ConstantsHelper.CALLBACK_ERROR_NONE,
ConstantsHelper.CALLBACK_ERROR_MESSAGE_NONE);
mNotifyBoundingBoxListenerOnNextDraw.set(true);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This wouldn't have done anything, anyway, as the mAdView was already set to null. Also there's a synchronous bounding box changed event immediately prior to this.

Copy link
Contributor

@sunmou99 sunmou99 left a comment

Choose a reason for hiding this comment

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

Do we need to add some logs or throw errors when it's a nullptr?

@DellaBitta
Copy link
Contributor Author

DellaBitta commented Nov 16, 2021

Do we need to add some logs or throw errors when it's a nullptr?

I don't think so. The most common scenario is starting the process of destroying the C++ object when suddenly a listener is invoked from Android and iOS about movement, clicks, etc. This isn't a misconfiguration just a race condition. Or, say, respond to AdClosed by destroying the object before the final bounding box listener event triggers a -1,-1,-1,-1 bounding box, since AdClosed and the BoundingBox change are different events.

Copy link
Contributor

@sunmou99 sunmou99 left a comment

Choose a reason for hiding this comment

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

Check no pointer erros. LGTM.

@DellaBitta DellaBitta merged commit 27203e2 into feature/admob_2021 Nov 18, 2021
@DellaBitta DellaBitta deleted the feature/admob_2021_stability branch November 18, 2021 18:12
@github-actions github-actions bot added the tests: in-progress This PR's integration tests are in progress. label Nov 18, 2021
@github-actions
Copy link

github-actions bot commented Nov 18, 2021

❌  Integration test FAILED

Requested by @DellaBitta on commit 27203e2
Last updated: Thu Nov 18 12:48 PST 2021
View integration test log & download artifacts

Failures Configs
admob [TEST] [ERROR] [Android] [All os] [android_target]
auth [TEST] [ERROR] [Android] [windows] [android_target]
messaging [TEST] [ERROR] [Android] [macos] [android_target]
remote_config [TEST] [ERROR] [Android] [windows] [android_target]

Add flaky tests to go/fpl-cpp-flake-tracker

@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label Nov 18, 2021
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Nov 18, 2021
@firebase firebase locked and limited conversation to collaborators Dec 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes tests: failed This PR's integration tests failed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants