Skip to content

Commit

Permalink
Merge pull request #2217 from decden/2216-observable-array-leaks-last…
Browse files Browse the repository at this point in the history
…-value

Fixed memory leak of previousContents when tracking array changes and disposing the subscription
  • Loading branch information
mbest committed Apr 8, 2017
2 parents 5f0b9a7 + 797e002 commit 0ee72ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/subscribables/observableArray.changeTracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ ko.extenders['trackArrayChanges'] = function(target, options) {
target['notifySubscribers'] = underlyingNotifySubscribersFunction;
underlyingNotifySubscribersFunction = undefined;
}
arrayChangeSubscription.dispose();
if (arrayChangeSubscription) {
arrayChangeSubscription.dispose();
}
arrayChangeSubscription = null;
trackingChanges = false;
}
};
Expand Down

0 comments on commit 0ee72ac

Please sign in to comment.