diff --git a/lib/OpenLayers/Feature.js b/lib/OpenLayers/Feature.js index 83b58dda98..82e0db2269 100644 --- a/lib/OpenLayers/Feature.js +++ b/lib/OpenLayers/Feature.js @@ -46,8 +46,10 @@ OpenLayers.Feature.prototype= { destroy: function() { //remove the popup from the map - if (this.popup != null) { - this.layer.map.removePopup(this.popup); + if ((this.layer != null) && (this.layer.map != null)) { + if (this.popup != null) { + this.layer.map.removePopup(this.popup); + } } this.events = null; diff --git a/lib/OpenLayers/Layer/WFS.js b/lib/OpenLayers/Layer/WFS.js index 38ef5b6255..6b1f3d7e8f 100644 --- a/lib/OpenLayers/Layer/WFS.js +++ b/lib/OpenLayers/Layer/WFS.js @@ -47,6 +47,14 @@ OpenLayers.Layer.WFS.prototype = }, + /** + * + */ + destroy: function() { + OpenLayers.Layer.Grid.prototype.destroy.apply(this, arguments); + OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments); + }, + /** * @param {OpenLayers.Bounds} bounds * @param {Boolean} zoomChanged