From c2b1775d756e624187e940308c49a77bd3396357 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 17 Feb 2015 08:35:32 -0800 Subject: [PATCH] [Fixed Position] Free up resources Free up resources when a fixed position view is destroyed, WTD-889. --- platform/features/layout/src/FixedController.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index 2028a2d4e4..9dc59c1764 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -124,6 +124,14 @@ define( } } + // Free up subscription to telemetry + function releaseSubscription() { + if (subscription) { + subscription.unsubscribe(); + subscription = undefined; + } + } + // Subscribe to telemetry updates for this domain object function subscribe(domainObject) { // Clear any old values @@ -145,6 +153,9 @@ define( // Subscribe to telemetry when an object is available $scope.$watch("domainObject", subscribe); + // Free up subscription on destroy + $scope.$on("$destroy", releaseSubscription); + // Initialize styles (position etc.) for cells refreshCellStyles();