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

ImaAdsLoader leaks AdEventListener within its AdsManager #6687

Closed
nihk opened this issue Nov 24, 2019 · 1 comment
Closed

ImaAdsLoader leaks AdEventListener within its AdsManager #6687

nihk opened this issue Nov 24, 2019 · 1 comment
Assignees
Labels

Comments

@nihk
Copy link

nihk commented Nov 24, 2019

Not sure if this is intentional or not, or whether I'm just using the API incorrectly, but I noticed that the value given to ImaAdsLoader.Builder.setAdEventListener(AdEventListener) never gets removed from the AdsManager instance it owns. The consequence of this in my app is where if I'm playing an ad, then call ImaAdsLoader.release() the ImaAdsLoader's AdsManager still holds onto my AdEventListener and sends it an AdEvent with type AdEventType.CONTENT_RESUME_REQUESTED, which I don't want (I would've expected ImaAdsLoader.release() to remove the AdEventListener I gave it during instantiation, for me).

There's no method that I'm aware of on ImaAdsLoader to remove my AdEventListener, so as a workaround I have to tap into ImaAdsLoader.getAdsLoader().addAdsLoadedListener(...) then hold onto the AdsManager myself and manage its ownership of my AdEventListener.

I can provide a more comprehensive bug report if the above details are insufficient.

Version used: 2.9.0

@ojw28
Copy link
Contributor

ojw28 commented Nov 24, 2019

We call adsManager.destroy() from ImaAdsLoader.release(). It's possible we assumed that this would be sufficient to stop the AdsManager from subsequently calling its listeners.

If that's not the case then we should probably remove the listeners in addition to calling destroy() (i.e. adEventListener, and probably this x2 as well)?

marcbaechinger pushed a commit that referenced this issue Dec 4, 2019
Issue: #6687
PiperOrigin-RevId: 283023548
@ojw28 ojw28 closed this as completed Dec 6, 2019
ojw28 pushed a commit that referenced this issue Dec 6, 2019
Issue: #6687
PiperOrigin-RevId: 283023548
@google google locked and limited conversation to collaborators Feb 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants