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.