fixed memory leak in the PanZoom control. Thanks rcoup for the patch and the test. p=rcoup, r=me (closes #2323)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9763 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2009-10-25 17:36:10 +00:00
parent 56382e8e49
commit dbcab22339
2 changed files with 42 additions and 0 deletions

View File

@@ -163,6 +163,7 @@ OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, {
_removeButton: function(btn) {
OpenLayers.Event.stopObservingElement(btn);
btn.map = null;
btn.getSlideFactor = null;
this.div.removeChild(btn);
OpenLayers.Util.removeItem(this.buttons, btn);
},

View File

@@ -0,0 +1,41 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Memory Test - PanZoom.getSlideFactor</title>
<style type="text/css">
body {
font-size: 0.8em;
}
p {
padding-top: 1em;
}
#map {
width: 256px;
height: 256px;
border: 1px solid black;
}
</style>
<script src="../../../lib/Firebug/firebug.js"></script>
<script src="../../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map;
var layer;
function init(){
map = new OpenLayers.Map('map');
}
</script>
</head>
<body onload="init()">
<h1 id="title">Memory Test - PanZoom.getSlideFactor</h1>
<pre id="status"></pre>
<div id="map"></div>
<p>
This test is a memory leak test for: PanZoom.getSlideFactor.
</p>
<p>
Run this test in IE6/7 with <a href="http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector-v2.aspx">JavaScript Memory Leak Detector v2</a>
and watch it identify a leak unless this is fixed.
</p>
</body>
</html>