make OverviewMap.destroy more robust, r=fredj (closes #2430)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9957 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2010-01-22 07:35:22 +00:00
parent 8cbac47177
commit e562626f87
+16 -7
View File
@@ -143,16 +143,25 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
if (!this.mapDiv) { // we've already been destroyed if (!this.mapDiv) { // we've already been destroyed
return; return;
} }
this.handlers.click.destroy(); if (this.handlers.click) {
this.handlers.drag.destroy(); this.handlers.click.destroy();
}
if (this.handlers.drag) {
this.handlers.drag.destroy();
}
this.mapDiv.removeChild(this.extentRectangle); this.mapDiv.removeChild(this.extentRectangle);
this.extentRectangle = null; this.extentRectangle = null;
this.rectEvents.destroy();
this.rectEvents = null;
this.ovmap.destroy(); if (this.rectEvents) {
this.ovmap = null; this.rectEvents.destroy();
this.rectEvents = null;
}
if (this.ovmap) {
this.ovmap.destroy();
this.ovmap = null;
}
this.element.removeChild(this.mapDiv); this.element.removeChild(this.mapDiv);
this.mapDiv = null; this.mapDiv = null;
@@ -171,7 +180,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
this.div.removeChild(this.minimizeDiv); this.div.removeChild(this.minimizeDiv);
this.minimizeDiv = null; this.minimizeDiv = null;
} }
this.map.events.un({ this.map.events.un({
"moveend": this.update, "moveend": this.update,
"changebaselayer": this.baseLayerDraw, "changebaselayer": this.baseLayerDraw,