Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition when removing the map during a pan animation #6115

Open
arnarp opened this issue Apr 3, 2018 · 5 comments
Open

Race condition when removing the map during a pan animation #6115

arnarp opened this issue Apr 3, 2018 · 5 comments

Comments

@arnarp
Copy link

arnarp commented Apr 3, 2018

How to reproduce

  • Leaflet version I'm using: 1.3.1
  • Browser (with version) I'm using: Mobile Safari
  • OS/Platform (with version) I'm using: iOS 11 & 10
  • This is an error reported by my Sentry system. This event has been reported 71 times.
  • Open this pen in Safari https://codepen.io/arnarbirgisson/pen/XEYvEE?editors=1010
  • It will unmount leaflet after 5 seconds, so pan around until it is removed. When it is removed a type error occurs.

What behaviour I'm expecting and which behaviour I'm seeing

logint_li_farsimabanki-einstaklinga_issues_11498_

@IvanSanchez
Copy link
Member

It's very hard to know what's going on without a reproducible example. Can you try on a controlled environment, seeing if panning the map around makes this error show up on Safari?

@arnarp
Copy link
Author

arnarp commented Apr 3, 2018

I found a way to reproduce. I updated the issue

@arnarp
Copy link
Author

arnarp commented Apr 3, 2018

Possible fix is to change map/Map.js

_onPanTransitionEnd: function () {
  DomUtil.removeClass(this._mapPane, 'leaflet-pan-anim');
  this.fire('moveend');
}

to

_onPanTransitionEnd: function () {
  if (this._mapPane !== undefined) {
    DomUtil.removeClass(this._mapPane, 'leaflet-pan-anim');
  }
  this.fire('moveend');
}

because this._mapPane is possible undefined

@IvanSanchez IvanSanchez changed the title TypeError undefined is not an object (evaluating 'e.classList') Race condition when removing the map during a pan animation Apr 3, 2018
@IvanSanchez
Copy link
Member

@arnarp Could you please try if adding

if (this._panAnim) {
  this._panAnim.stop();
}

to the remove() method of Map would also solve the issue? I feel like it might be a slightly cleaner solution.

@IvanSanchez
Copy link
Member

Wait, this should already be happening since #5876 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants