Fix a memory leak in Tile.Image when using AlphaHack. r=crschmidt (closes #1848)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@8407 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Frédéric Junod
2008-11-21 15:04:52 +00:00
parent d64cec2db2
commit d695c29269
2 changed files with 44 additions and 3 deletions

View File

@@ -109,10 +109,14 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
destroy: function() {
if (this.imgDiv != null) {
if (this.layerAlphaHack) {
// unregister the "load" handler
OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0].id);
} else {
OpenLayers.Event.stopObservingElement(this.imgDiv.id);
}
// unregister the "load" and "error" handlers. Only the "error" handler if
// this.layerAlphaHack is true.
OpenLayers.Event.stopObservingElement(this.imgDiv.id);
if (this.imgDiv.parentNode == this.frame) {
this.frame.removeChild(this.imgDiv);
this.imgDiv.map = null;