Only destroy events if they are not already destroyed. This is relevant for controls with obligate controls. Since the map thinks it is in charge of destroying controls, and parent controls also destroy obligate controls, control.destroy ends up getting called twice. If someone wants to change the way this is handled, we should have a standard property that lets the map know that control.destroy is the responsibility of someone else. r=crschmidt (closes #1346)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6230 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-02-12 16:43:47 +00:00
parent 49c7ec2739
commit 57f6d9b914

View File

@@ -165,8 +165,10 @@ OpenLayers.Control = OpenLayers.Class({
* to prevent memory leaks.
*/
destroy: function () {
if(this.events) {
this.events.destroy();
this.events = null;
}
// eliminate circular references
if (this.handler) {
this.handler.destroy();