[Pkg-javascript-commits] [leaflet-markercluster] 183/479: Fix up crashes removing the MarkerClusterGroup from the map in a zoomstart/end handler. Crashes could come still happen depending on the order the handlers were called. Refs #36
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:00:27 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit 6c4c0f1e338c8918df8d1d5ecca76c58e75a88f7
Author: danzel <danzel at localhost.geek.nz>
Date: Mon Aug 27 13:55:44 2012 +1200
Fix up crashes removing the MarkerClusterGroup from the map in a zoomstart/end handler. Crashes could come still happen depending on the order the handlers were called. Refs #36
---
src/MarkerCluster.Spiderfier.js | 5 +++++
src/MarkerClusterGroup.js | 4 +++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index 21209d0..f3961dd 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -320,12 +320,17 @@ L.MarkerClusterGroup.include({
_spiderfierOnRemove: function () {
this._map.off('click', this._unspiderfyWrapper, this);
this._map.off('zoomstart', this._unspiderfyZoomStart, this);
+ this._map.off('zoomanim', this._unspiderfyZoomAnim, this);
},
//On zoom start we add a zoomanim handler so that we are guaranteed to be last (after markers are animated)
//This means we can define the animation they do rather than Markers doing an animation to their actual location
_unspiderfyZoomStart: function () {
+ if (!this._map) { //May have been removed from the map by a zoomEnd handler
+ return;
+ }
+
this._map.on('zoomanim', this._unspiderfyZoomAnim, this);
},
_unspiderfyZoomAnim: function (zoomDetails) {
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 6601a6a..d556ace 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -222,7 +222,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
},
_zoomEnd: function () {
-
+ if (!this._map) { //May have been removed from the map by a zoomEnd handler
+ return;
+ }
this._mergeSplitClusters();
this._zoom = this._map._zoom;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git
More information about the Pkg-javascript-commits
mailing list