Closed GoogleCodeExporter closed 8 years ago
Here below is the code change that I'm proposing for the MDIManager's remove
method.
It includes also releasing the MDIWindow's windowManager reference to prevent
memory
leaks.
Additionally it raises a new MDIWindowEvent.CLOSED event to notify the
MDIWindow
that has been closed and released from the MDIManager and therefore it is time
to
perform any necessary cleanup to be garbage collected.
/**
* Removes a window instance from the managed window stack
* @param window:MDIWindow Window to remove
*/
public function remove(window:MDIWindow):void
{
var index:int = ArrayUtil.getItemIndex(window,
this.windowList);
windowList.splice(index, 1);
if(this.isGlobal)
{
PopUpManager.removePopUp(window as
IFlexDisplayObject);
}
else
{
container.removeChild(window);
if( container.numChildren > 0 ) {
var newFocusWindow:MDIWindow = MDIWindow(
container.getChildAt( container.numChildren - 1 ));
newFocusWindow.dispatchEvent( new
MDIWindowEvent( MDIWindowEvent.FOCUS_START, newFocusWindow ) );
}
}
this.removeListeners(window);
window.windowManager = null;
window.dispatchEvent( new MDIWindowEvent(
MDIWindowEvent.CLOSED, window ) );
}
Original comment by andrea.w...@gmail.com
on 13 Nov 2007 at 4:18
Original comment by ben.clin...@gmail.com
on 10 Jan 2008 at 7:16
Original issue reported on code.google.com by
andrea.w...@gmail.com
on 13 Nov 2007 at 3:46