|
|
|
[
Permlink
| « Hide
]
Tink - [07/23/08 05:17 AM ]
This is a super simple fix. It should be standard through the Flex framework that listeners are removed when items are destroyed.
Fixed in 3.0.x branch with change 3108.
I don't think the "removing and then creating extra thumbs" is really a problem when you consider how often this gets called, but feel free to open another bug about it. After some discussion, we decided it's best to just leave out code when it's not necessary. There's no memory leak here, so no need for the extra code.
Revertted the change in CL3123. Marking as NAB since this is not a memory leak. In this case, the event listener adds a reference from thumb to the parent object's handler. However, thumb still has 0 references to it, so it can be GCed as appropriate. "There's no memory leak here, so no need for the extra code."
I'm pretty sure this isn't the case. The thumb has a reference to it from the listener, therefore both the thumb and the listener are never eligible for garbage collection. package { import flash.display.Sprite; import flash.events.Event; public class Listener extends Sprite { public function Listener() { var sprite:Sprite = new Sprite() sprite.addEventListener( Event.ENTER_FRAME, onEnterFrame ); } private function onEnterFrame( event:Event ):void { trace( "onEnterFrame" ); } } } The example above is very much like the thumb. The only reference to the Sprite is the listener that was added to it. Due to the listener having a reference, both the spite and listener are never garbage collection. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||