Skip to content

Commit

Permalink
fix: Fix memory leak on SimpleAbrManager (#5478)
Browse files Browse the repository at this point in the history
closes
[#5477](#5477)

Moving `this.onNetworkInformationChange_ = null;` before creating the
navigator.connection event listener.
Currently it resets it to null after creating the listener so the
release() wont be able to remove the eventlistener
  • Loading branch information
tyrelltle authored and joeyparrish committed Aug 19, 2023
1 parent 5fb44db commit f8cb6ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/abr/simple_abr_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ shaka.abr.SimpleAbrManager = class {
/** @private {shaka.abr.EwmaBandwidthEstimator} */
this.bandwidthEstimator_ = new shaka.abr.EwmaBandwidthEstimator();

/** @private {?function():void} */
this.onNetworkInformationChange_ = null;

// Some browsers implement the Network Information API, which allows
// retrieving information about a user's network connection. We listen
// to the change event to be able to make quick changes in case the type
Expand Down Expand Up @@ -98,9 +101,6 @@ shaka.abr.SimpleAbrManager = class {
/** @private {ResizeObserver} */
this.resizeObserver_ = null;

/** @private {?function():void} */
this.onNetworkInformationChange_ = null;

/** @private {shaka.util.Timer} */
this.resizeObserverTimer_ = new shaka.util.Timer(() => {
if (this.config_.restrictToElementSize) {
Expand Down

0 comments on commit f8cb6ef

Please sign in to comment.