[OpenLayers-Commits] r7485 - sandbox/vector-behavior/lib/OpenLayers/Layer

commits at openlayers.org commits at openlayers.org
Wed Jul 9 11:44:06 EDT 2008


Author: elemoine
Date: 2008-07-09 11:44:06 -0400 (Wed, 09 Jul 2008)
New Revision: 7485

Modified:
   sandbox/vector-behavior/lib/OpenLayers/Layer/Vector.js
Log:
destroy things in correct order; in particular destroy strategies before destroying the renderer, strategies may required the renderer when destroying features for example


Modified: sandbox/vector-behavior/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/vector-behavior/lib/OpenLayers/Layer/Vector.js	2008-07-09 15:29:15 UTC (rev 7484)
+++ sandbox/vector-behavior/lib/OpenLayers/Layer/Vector.js	2008-07-09 15:44:06 UTC (rev 7485)
@@ -234,21 +234,6 @@
      * Destroy this layer
      */
     destroy: function() {
-        this.destroyFeatures();
-        this.features = null;
-        this.featureMap = null;
-        this.selectedFeatures = null;
-        if (this.renderer) {
-            this.renderer.destroy();
-        }
-        this.renderer = null;
-        this.geometryType = null;
-        this.drawn = null;
-
-        if (this.protocol) {
-            this.protocol.destroy();
-            this.protocol = null;
-        }
         if (this.stategies) {
             for(var i = 0; i < this.strategies.length; i++){
                 this.strategies[i].destroy();
@@ -260,6 +245,20 @@
             this.strategy.destroy();
             this.strategy = null;
         }
+        if (this.protocol) {
+            this.protocol.destroy();
+            this.protocol = null;
+        }
+        this.destroyFeatures();
+        this.features = null;
+        this.featureMap = null;
+        this.selectedFeatures = null;
+        if (this.renderer) {
+            this.renderer.destroy();
+        }
+        this.renderer = null;
+        this.geometryType = null;
+        this.drawn = null;
         OpenLayers.Layer.prototype.destroy.apply(this, arguments);  
     },
     



More information about the Commits mailing list