Remove AdsManager listeners on release

Issue: #6687
PiperOrigin-RevId: 283023548
This commit is contained in:
andrewlewis 2019-11-29 09:30:52 +00:00 committed by bachinger
parent 1536a2ceea
commit a0736cfbf5
2 changed files with 8 additions and 0 deletions

View File

@ -157,6 +157,9 @@
[Cast demo app](https://github.com/google/ExoPlayer/tree/dev-v2/demos/cast).
* TestUtils: Publish the `testutils` module to simplify unit testing with
ExoPlayer ([#6267](https://github.com/google/ExoPlayer/issues/6267)).
* IMA extension: Remove `AdsManager` listeners on release to avoid leaking an
`AdEventListener` provided by the app
([#6687](https://github.com/google/ExoPlayer/issues/6687)).
### 2.10.8 (2019-11-19) ###

View File

@ -646,6 +646,11 @@ public final class ImaAdsLoader
public void release() {
pendingAdRequestContext = null;
if (adsManager != null) {
adsManager.removeAdErrorListener(this);
adsManager.removeAdEventListener(this);
if (adEventListener != null) {
adsManager.removeAdEventListener(adEventListener);
}
adsManager.destroy();
adsManager = null;
}