From f5c627ab519a25cb5d5bbc6b4442472ff3b0d8cc Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 13 Feb 2013 15:37:33 -0700 Subject: [PATCH] Only listen once for tile events Assuming browser garbage collection cannot happen while we have listeners in the global registry, we need to listenOnce to avoid memory leaks with the tile queue. --- src/ol/tilequeue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/tilequeue.js b/src/ol/tilequeue.js index 64984ba1a8..c5788df972 100644 --- a/src/ol/tilequeue.js +++ b/src/ol/tilequeue.js @@ -174,7 +174,7 @@ ol.TileQueue.prototype.loadMoreTiles = function() { var tile; while (this.heap_.length > 0 && this.tilesLoading_ < this.maxTilesLoading_) { tile = /** @type {ol.Tile} */ (this.dequeue_()); - goog.events.listen(tile, goog.events.EventType.CHANGE, + goog.events.listenOnce(tile, goog.events.EventType.CHANGE, this.handleTileChange, false, this); tile.load(); ++this.tilesLoading_;