fixed memory leak in Marker.js. With manual test. p=rcoup, r=me (closes #2258)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9754 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -78,7 +78,6 @@ OpenLayers.Marker = OpenLayers.Class({
|
||||
this.icon.offset = newIcon.offset;
|
||||
this.icon.calculateOffset = newIcon.calculateOffset;
|
||||
}
|
||||
this.events = new OpenLayers.Events(this, this.icon.imageDiv, null);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -94,9 +93,6 @@ OpenLayers.Marker = OpenLayers.Class({
|
||||
|
||||
this.map = null;
|
||||
|
||||
this.events.destroy();
|
||||
this.events = null;
|
||||
|
||||
if (this.icon != null) {
|
||||
this.icon.destroy();
|
||||
this.icon = null;
|
||||
@@ -115,6 +111,9 @@ OpenLayers.Marker = OpenLayers.Class({
|
||||
* location passed-in
|
||||
*/
|
||||
draw: function(px) {
|
||||
if (!this.events) {
|
||||
this.events = new OpenLayers.Events(this, this.icon.imageDiv, null);
|
||||
}
|
||||
return this.icon.draw(px);
|
||||
},
|
||||
|
||||
@@ -126,6 +125,10 @@ OpenLayers.Marker = OpenLayers.Class({
|
||||
if (this.icon != null) {
|
||||
this.icon.erase();
|
||||
}
|
||||
if (this.events) {
|
||||
this.events.destroy();
|
||||
this.events = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user