From 999b4d49f440c8b4a175b6899a58902c168ecb99 Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Fri, 15 May 2015 11:29:30 -0400 Subject: [PATCH] Fix issue with `_super` being removed from listeners See https://github.com/CartoDB/cartodb.js/issues/478#issuecomment-102415466 for more details. --- lib/torque/gmaps/gmaps_tileloader_mixin.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/torque/gmaps/gmaps_tileloader_mixin.js b/lib/torque/gmaps/gmaps_tileloader_mixin.js index a0c6a6c..b083f79 100644 --- a/lib/torque/gmaps/gmaps_tileloader_mixin.js +++ b/lib/torque/gmaps/gmaps_tileloader_mixin.js @@ -21,16 +21,17 @@ GMapsTileLoader.prototype = { }, _removeTileLoader: function() { - for(var i in this._listeners) { - google.maps.event.removeListener(this._listeners[i]); - } + this._listeners.forEach(function (listener) { + google.maps.event.removeListener(listener); + }); + this._removeTiles(); }, _removeTiles: function () { - for (var key in this._tiles) { - this._removeTile(key); - } + for (var key in this._tiles) { + this._removeTile(key); + } }, _reloadTiles: function() {