Clean up layers and controls a little more carefully in map.destroy(). Fixes #596.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2957 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -243,7 +243,7 @@ OpenLayers.Map.prototype = {
|
||||
this.unloadDestroy = null;
|
||||
|
||||
if (this.layers != null) {
|
||||
for(var i=0; i< this.layers.length; i++) {
|
||||
for (var i = this.layers.length - 1; i>=0; --i) {
|
||||
//pass 'false' to destroy so that map wont try to set a new
|
||||
// baselayer after each baselayer is removed
|
||||
this.layers[i].destroy(false);
|
||||
@@ -251,7 +251,7 @@ OpenLayers.Map.prototype = {
|
||||
this.layers = null;
|
||||
}
|
||||
if (this.controls != null) {
|
||||
for(var i=0; i< this.controls.length; i++) {
|
||||
for (var i = this.controls.length - 1; i>=0; --i) {
|
||||
this.controls[i].destroy();
|
||||
}
|
||||
this.controls = null;
|
||||
|
||||
Reference in New Issue
Block a user