rldjrsksl / flex-iframe

Automatically exported from code.google.com/p/flex-iframe
0 stars 0 forks source link

Dead iframes still alive when removed from SuperTabNavigator #61

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create SuperTabNavigator with  and couple of buttons to dymanically add
iframes to tabnav.
2. Add alerts for all methods which call hideDiv.
3. Open a few new tabs and then close them. Repeat the process.
See that "dead" iframes are still being alive and hideDiv is called for
them from handleChange or sometimes with null as id.

What is the expected output? What do you see instead?

I would expect IFrame once it's removed from supertabnavigator to be
garbage collected. Now this behavour results in many calls to hide js
function(easy to check by adding alert to hide js function) and memory is
not recovered.

What version of Flex-IFrame are you using? On what operating system and
which navigator (specify the version too)?

IFrame 1.4.3
FlexLib 1.2.4
Any browser
Flex 3.3

Please provide any additional information below, and a sample Flex 3
project reproducing the issue if possible.

These dead iframes are called from here, could this be because event
listeners are not deregistered? I am digging it up, but I am not that flex
expert

protected function handleChange(event:Event):void
        {
            var target:Object = event.target;

            if (event is IndexChangedEvent)
            {
                var changedEvent:IndexChangedEvent = IndexChangedEvent(event)
                var newIndex:Number = changedEvent.newIndex;

                Alert.show("Calling updateFrameVisibility from handleChange
with index = " + changedEvent.newIndex);
                var result:Boolean =
updateFrameVisibility(checkDisplay(target, newIndex));
                logger.debug("Frame {0} set visible to {1} on
IndexChangedEvent", _frameId, result);
            }
        }

Original issue reported on code.google.com by andrei.i...@gmail.com on 30 Dec 2009 at 5:04

GoogleCodeExporter commented 8 years ago
Managed to resolve it somewhat, now after Iframe is removed it's being GC-ed.
However debug shows that hide for Iframe is still called twice for same object 
- 
first with null _frameId and then with correct _frameId.

/**
         * Triggered by removal of this object from the stage.
         *
         * @param event Event trigger
         */
        protected function handleRemove(event:Event = null):void
        {
            logger.debug("The component for the IFrame with id '{0}' has been 
removed from the stage.", _frameId);
            var current:DisplayObjectContainer = parent;
            // Remove all event listeners to allow GC to collect this object
            this.removeEventListener(Event.REMOVED_FROM_STAGE, handleRemove);
            this.removeEventListener(Event.ADDED_TO_STAGE, handleAdd);
            systemManager.removeEventListener(Event.ADDED, 
systemManager_addedHandler);
            systemManager.removeEventListener(Event.REMOVED, 
systemManager_removedHandler);
            current.removeEventListener(IndexChangedEvent.CHANGE, handleChange);
            current.removeEventListener(MoveEvent.MOVE, handleMove);

            //Alert.show("Calling updateFrameVisibility from handleRemove with 
false");
            updateFrameVisibility(false);
        }

Original comment by andrei.i...@gmail.com on 31 Dec 2009 at 12:07

GoogleCodeExporter commented 8 years ago

Original comment by Julien.N...@gmail.com on 14 May 2010 at 4:59

GoogleCodeExporter commented 8 years ago
Moved to https://github.com/nicoulaj/flex-iframe/issues/43

Original comment by Julien.N...@gmail.com on 8 May 2011 at 1:25

GoogleCodeExporter commented 8 years ago

Original comment by Julien.N...@gmail.com on 8 May 2011 at 1:25

GoogleCodeExporter commented 8 years ago

Original comment by Julien.N...@gmail.com on 8 May 2011 at 1:25