Skip to content

Commit

Permalink
Explicitly remove controls from the map on map unload (Leaflet#6488)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanSanchez authored and Schleuse committed Dec 3, 2019
1 parent d9ca22d commit cd2a9f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/control/Control.js
Expand Up @@ -79,6 +79,8 @@ export var Control = Class.extend({
corner.appendChild(container);
}

this._map.on('unload', this.remove, this);

return this;
},

Expand All @@ -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;
Expand Down

0 comments on commit cd2a9f1

Please sign in to comment.