Destroy OL objects which use the dataLayer before we destroy the layer
authorTom Hughes <tom@compton.nu>
Mon, 11 May 2009 10:31:34 +0000 (10:31 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 11 May 2009 10:31:34 +0000 (10:31 +0000)
or we will get errors which stop the rest of stopBrowse() executing.

app/views/browse/start.rjs

index f38b1dc80937cb0c9f6355236fd87a2b50b01e49..8c8d622606c71910156540a8c01cd1f1de3c5afc 100644 (file)
@@ -50,11 +50,6 @@ page << <<EOJ
     if (browseActive) {
       browseActive = false;
 
-      if (browseDataLayer) {
-        browseDataLayer.destroy();
-        browseDataLayer = null; 
-      } 
-
       if (browseSelectControl) {   
         browseSelectControl.destroy();  
         browseSelectControl = null;
@@ -70,6 +65,11 @@ page << <<EOJ
         browseActiveFeature = null; 
       }
 
+      if (browseDataLayer) {
+        browseDataLayer.destroy();
+        browseDataLayer = null; 
+      } 
+
       map.dataLayer.setVisibility(false);
       map.events.unregister("moveend", map, showData);
     }