Fix(Map): stopLocate on map.remove (#5893)
so that Geolocation handlers (namely _handleGeolocationResponse and _handleGeolocationError) do not try to access DOM elements which have been cleared by map.remove(). Of course developer should currently call map.stopLocate() manually before map.remove(), but it looks like he/she may forget it. Check for _locationWatchId is not perfect (watch may have been already stopped), but calling stopLocate again does not harm. It prevents trying to access the Geolocation API if locate had never been called, even though doing so should not harm either.
This commit is contained in:
parent
8dbc4fc9d7
commit
cf518ff1a5
@ -722,6 +722,10 @@ export var Map = Evented.extend({
|
||||
this._containerId = undefined;
|
||||
}
|
||||
|
||||
if (this._locationWatchId !== undefined) {
|
||||
this.stopLocate();
|
||||
}
|
||||
|
||||
this._stop();
|
||||
|
||||
DomUtil.remove(this._mapPane);
|
||||
|
Loading…
Reference in New Issue
Block a user