OpenLayers OpenLayers

Changeset 2894

Show
Ignore:
Timestamp:
03/25/07 20:50:31 (2 years ago)
Author:
crschmidt
Message:

Commit small change to destroy events objects when destroying objects with
events. This removes a number of minor memory leaks with creating/destroying
popups, layers, features, and markers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Feature.js

    r2803 r2894  
    6060        } 
    6161 
     62        if (this.events) { 
     63            this.events.destroy(); 
     64        } 
    6265        this.events = null; 
     66         
    6367        this.layer = null; 
    6468        this.id = null; 
  • trunk/openlayers/lib/OpenLayers/Layer.js

    r2543 r2894  
    155155        this.div = null; 
    156156        this.options = null; 
     157         
     158        this.events.destroy(); 
    157159        this.events = null; 
    158160    }, 
  • trunk/openlayers/lib/OpenLayers/Marker.js

    r2817 r2894  
    4848    destroy: function() { 
    4949        this.map = null; 
    50          
     50 
     51        this.events.destroy(); 
     52        this.events = null; 
     53 
    5154        if (this.icon != null) { 
    5255            this.icon.destroy(); 
  • trunk/openlayers/lib/OpenLayers/Popup.js

    r2803 r2894  
    118118        if (this.map != null) { 
    119119            this.map.removePopup(this); 
    120         } 
     120            this.map = null; 
     121        } 
     122        this.events.destroy(); 
     123        this.events = null; 
    121124        this.div = null; 
    122         this.map = null; 
    123125    }, 
    124126 
  • trunk/openlayers/tests/test_Events.html

    r2867 r2894  
    213213             start + OpenLayers.Events.prototype.BROWSER_EVENTS.length + 1, 
    214214             "construction increases the number of event observers"); 
    215         events = events.destroy(); 
     215        events.destroy(); 
     216        events = null; 
    216217        t.eq(OpenLayers.Event.observers.length, start, 
    217218             "destruction restores the number of event observers");