Adding explicit eventListener unregistering in map, layer, and control destroy methods. Note that this only makes explicit what is already happening elsewhere, but it makes us feel complete. Also throwing in the example I missed in the previous change. r=euzuro (closes #1404)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6447 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-03-06 18:24:18 +00:00
parent 21c097a297
commit e7b9a9a41b
4 changed files with 167 additions and 0 deletions

View File

@@ -178,9 +178,14 @@ OpenLayers.Control = OpenLayers.Class({
*/
destroy: function () {
if(this.events) {
if(this.eventListeners) {
this.events.un(this.eventListeners);
}
this.events.destroy();
this.events = null;
}
this.eventListeners = null;
// eliminate circular references
if (this.handler) {
this.handler.destroy();