Subclasses of markers layer should destroy, then clear their list of markers.
Thanks crschmidt for the review. (closes #1123) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5465 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -75,9 +75,14 @@ OpenLayers.Layer.GeoRSS = OpenLayers.Class(OpenLayers.Layer.Markers, {
|
||||
* Method: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
// Warning: Layer.Markers.destroy() must be called prior to calling
|
||||
// clearFeatures() here, otherwise we leak memory. Indeed, if
|
||||
// Layer.Markers.destroy() is called after clearFeatures(), it won't be
|
||||
// able to remove the marker image elements from the layer's div since
|
||||
// the markers will have been destroyed by clearFeatures().
|
||||
OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
|
||||
this.clearFeatures();
|
||||
this.features = null;
|
||||
OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,9 +86,14 @@ OpenLayers.Layer.Text = OpenLayers.Class(OpenLayers.Layer.Markers, {
|
||||
* APIMethod: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
// Warning: Layer.Markers.destroy() must be called prior to calling
|
||||
// clearFeatures() here, otherwise we leak memory. Indeed, if
|
||||
// Layer.Markers.destroy() is called after clearFeatures(), it won't be
|
||||
// able to remove the marker image elements from the layer's div since
|
||||
// the markers will have been destroyed by clearFeatures().
|
||||
OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
|
||||
this.clearFeatures();
|
||||
this.features = null;
|
||||
OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user