From 4bb320867ba320c6dbaacee8a5eab534d76d0fc7 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Thu, 29 Mar 2007 04:43:18 +0000 Subject: [PATCH] "add a destroy() function that cycles through the kept references to the buttons and kills their circular refs" to the map object. Patch in #578 by euzuro git-svn-id: http://svn.openlayers.org/trunk/openlayers@2919 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/MouseToolbar.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/OpenLayers/Control/MouseToolbar.js b/lib/OpenLayers/Control/MouseToolbar.js index 25fbfef97e..0baa38b806 100644 --- a/lib/OpenLayers/Control/MouseToolbar.js +++ b/lib/OpenLayers/Control/MouseToolbar.js @@ -57,6 +57,19 @@ OpenLayers.Control.MouseToolbar.prototype = return this.div; }, + + /** + * + */ + destroy: function() { + for( var btnId in this.buttons) { + var btn = this.buttons[btnId]; + btn.map = null; + btn.events.destroy(); + } + OpenLayers.Control.MouseDefaults.prototype.destroy.apply(this, + arguments); + }, _addButton:function(id, img, activeImg, xy, sz, title) { var imgLocation = OpenLayers.Util.getImagesLocation() + img;