From fdcc5d6b71adcb0995daa218c879433c12362957 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Tue, 8 Mar 2016 16:19:48 -0400 Subject: [PATCH] Stop scanner interval before starting a new one This ensures there are no orphaned intervals running. --- lib/browser/modules/drive-scanner.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/browser/modules/drive-scanner.js b/lib/browser/modules/drive-scanner.js index da5f7811..97113d2d 100644 --- a/lib/browser/modules/drive-scanner.js +++ b/lib/browser/modules/drive-scanner.js @@ -133,6 +133,10 @@ driveScanner.service('DriveScannerService', function($q, $interval, $timeout) { }); }; + // Make sure any pending interval is cancelled + // to avoid potential memory leaks. + self.stop(); + // Call fn after in the next process tick // to be able to capture the first run // in unit tests.