From 50dcb4482aeb5c627f0d736e1ed608c9e175afb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20S=C3=A1nchez=20Ortega?= Date: Tue, 22 Jan 2019 16:45:37 +0100 Subject: [PATCH] Explicitly remove controls from the map on map unload --- src/control/Control.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/control/Control.js b/src/control/Control.js index 6db9f4bb0fa..301541914c4 100644 --- a/src/control/Control.js +++ b/src/control/Control.js @@ -79,6 +79,8 @@ export var Control = Class.extend({ corner.appendChild(container); } + this._map.on('unload', this.remove, this); + return this; }, @@ -95,6 +97,7 @@ export var Control = Class.extend({ this.onRemove(this._map); } + this._map.off('unload', this.remove, this); this._map = null; return this;