OpenLayers OpenLayers

Changeset 7485

Show
Ignore:
Timestamp:
07/09/08 11:44:06 (2 months ago)
Author:
elemoine
Message:

destroy things in correct order; in particular destroy strategies before destroying the renderer, strategies may required the renderer when destroying features for example

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/vector-behavior/lib/OpenLayers/Layer/Vector.js

    r7484 r7485  
    235235     */ 
    236236    destroy: function() { 
     237        if (this.stategies) { 
     238            for(var i = 0; i < this.strategies.length; i++){ 
     239                this.strategies[i].destroy(); 
     240                this.strategies[i] = null; 
     241            } 
     242            this.strategies = null; 
     243        } 
     244        if (this.strategy) { 
     245            this.strategy.destroy(); 
     246            this.strategy = null; 
     247        } 
     248        if (this.protocol) { 
     249            this.protocol.destroy(); 
     250            this.protocol = null; 
     251        } 
    237252        this.destroyFeatures(); 
    238253        this.features = null; 
     
    245260        this.geometryType = null; 
    246261        this.drawn = null; 
    247  
    248         if (this.protocol) { 
    249             this.protocol.destroy(); 
    250             this.protocol = null; 
    251         } 
    252         if (this.stategies) { 
    253             for(var i = 0; i < this.strategies.length; i++){ 
    254                 this.strategies[i].destroy(); 
    255                 this.strategies[i] = null; 
    256             } 
    257             this.strategies = null; 
    258         } 
    259         if (this.strategy) { 
    260             this.strategy.destroy(); 
    261             this.strategy = null; 
    262         } 
    263262        OpenLayers.Layer.prototype.destroy.apply(this, arguments);   
    264263    },