shramov / leaflet-plugins

Plugins for Leaflet library
http://psha.org.ru/b/leaflet-plugins.html
MIT License
722 stars 289 forks source link

Leaflet Map#remove() operations sequence shows that Yandex layer onRemove() method hasn't work properly #270

Closed zaycker closed 6 years ago

zaycker commented 6 years ago

Leaflet@1.3.1 leaflet-plugins@latest

Map#remove() method has such operations sequence:

/* line #732 */
if (this._clearControlPos) {
  this._clearControlPos();
}

/* ... */

/* line #746 */
for (i in this._layers) {
  this._layers[i].remove();
}

Map#_clearControlPos() removes _controlCorners property. Then if you look into L.Yandex#onRemove() you will see such line:

/* line #78 */
map._controlCorners.bottomright.style.marginBottom = '0em';

It fails with exception while in a process of removing map cause it tries to use properties of deleted object.

Am I wrong? 🤔

brunob commented 6 years ago

Closed by #271 :)