Fix MenuBar.styleChanged() crash bug menuBarItems.length may be modified as a result of calling getMenuAt(), so we should not save the length value before entering a loop.
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/cfbcc4d5 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/cfbcc4d5 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/cfbcc4d5 Branch: refs/heads/release4.15.0 Commit: cfbcc4d552d7622bb865ed855c8bb61e52016f76 Parents: 129366b Author: Andy Dufilie <[email protected]> Authored: Tue Jul 15 12:27:41 2014 -0400 Committer: Andy Dufilie <[email protected]> Committed: Tue Jul 15 12:27:41 2014 -0400 ---------------------------------------------------------------------- frameworks/projects/mx/src/mx/controls/MenuBar.as | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/cfbcc4d5/frameworks/projects/mx/src/mx/controls/MenuBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/mx/src/mx/controls/MenuBar.as b/frameworks/projects/mx/src/mx/controls/MenuBar.as index c4158b2..62ee1e2 100644 --- a/frameworks/projects/mx/src/mx/controls/MenuBar.as +++ b/frameworks/projects/mx/src/mx/controls/MenuBar.as @@ -1410,8 +1410,7 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent var i:int; super.styleChanged(styleProp); - var n:int = menuBarItems.length; - for (i = 0; i < n; i++) + for (i = 0; i < menuBarItems.length; i++) { getMenuAt(i).styleChanged(styleProp); } @@ -1447,8 +1446,7 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent { super.notifyStyleChangeInChildren(styleProp, recursive); - var n:int = menuBarItems.length; - for (var i:int = 0; i < n; i++) + for (var i:int = 0; i < menuBarItems.length; i++) { getMenuAt(i).notifyStyleChangeInChildren(styleProp, recursive); }
