[OpenLayers-Trac] [OpenLayers] #745: Error in Layer.Image on close
OpenLayers
trac at openlayers.org
Fri Jun 8 12:49:51 EDT 2007
#745: Error in Layer.Image on close
------------------------+---------------------------------------------------
Reporter: openlayers | Owner:
Type: bug | Status: new
Priority: minor | Milestone:
Component: general | Version: 2.4
Keywords: |
------------------------+---------------------------------------------------
With a simple map containing only an image layer and no controls, error
occurs in Layer.image.js when browser is closed.
{{{
function init() {
var map = new OpenLayers.Map( 'map', { controls: [] } );
var baseLayer = new OpenLayers.Layer.Image('Image',
'images/whitepixel.png',
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
new OpenLayers.Size(512, 512), {numZoomLevels: 3});
map.addLayer(baseLayer);
}
}}}
Layer/Image.js line 70-74:
{{{
destroy: function() {
this.tile.destroy();
this.tile = null;
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
}}}
Problem is that this.tile is null, until moveTo() is called. If moveTo()
has not been called, this.tile is null, and when destroy() is called we
get an error.
Fix is simple:
{{{
destroy: function() {
if (this.tile != null)
this.tile.destroy();
this.tile = null;
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
}}}
--
Ticket URL: <http://trac.openlayers.org/ticket/745>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list