Commit 5f465f77 by andrewlewis Committed by Oliver Woodman

Remove AdsManager listeners on release

Issue: #6687
PiperOrigin-RevId: 283023548
parent 9d9a2a68
......@@ -140,6 +140,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) ###
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment