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
+15 -6
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;