From f1d7e2ec8519008946521e98b52760baf7260d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Mon, 30 Mar 2015 16:54:09 +0200 Subject: [PATCH] Unregister tile change listeners When the tile queue loads a tile it registers a "change" listener on that tile. But currently that listener is not unregistered, unless the tile cache containing that tile fills up and "dipose" is called on that tile. This commit makes handleTileChange deregister the "change" listener on the tile, if the tile is now in "loaded" state. --- src/ol/tilequeue.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ol/tilequeue.js b/src/ol/tilequeue.js index 68da9ed5fa..5da58713fc 100644 --- a/src/ol/tilequeue.js +++ b/src/ol/tilequeue.js @@ -76,6 +76,8 @@ ol.TileQueue.prototype.handleTileChange = function(event) { var state = tile.getState(); if (state === ol.TileState.LOADED || state === ol.TileState.ERROR || state === ol.TileState.EMPTY) { + goog.events.unlisten(tile, goog.events.EventType.CHANGE, + this.handleTileChange, false, this); --this.tilesLoading_; this.tileChangeCallback_(); }