From def14318a64b86a074f554b3a7ee015218f9a443 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Mon, 2 Apr 2007 11:19:32 +0000 Subject: [PATCH] If a vector feature has a layer and it is destroyed, remove the feature from the layer, and reset the layer to null. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2971 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Feature/Vector.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/OpenLayers/Feature/Vector.js b/lib/OpenLayers/Feature/Vector.js index ede230e254..218590fafd 100644 --- a/lib/OpenLayers/Feature/Vector.js +++ b/lib/OpenLayers/Feature/Vector.js @@ -58,6 +58,11 @@ OpenLayers.Feature.Vector.prototype = * */ destroy: function() { + if (this.layer) { + this.layer.removeFeatures(this); + this.layer = null; + } + this.geometry = null; OpenLayers.Feature.prototype.destroy.apply(this, arguments); },