if the layer has a map property, remove it from the map before destroying.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@539 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-06-07 16:00:44 +00:00
parent 3b443ca2c9
commit 7e6b3b2a34

View File

@@ -31,6 +31,9 @@ OpenLayers.Layer.prototype = {
* the Javascript garbage cleaner can not take care of on its own. * the Javascript garbage cleaner can not take care of on its own.
*/ */
destroy: function() { destroy: function() {
if (this.map != null) {
this.map.removeLayer(this);
}
this.map = null; this.map = null;
}, },