diff options
author | dgp <dgp@users.sourceforge.net> | 2014-08-13 11:39:50 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-08-13 11:39:50 (GMT) |
commit | 2d22dd5c2be401b2a9336d8e9d5e46a2c71b15f3 (patch) | |
tree | 0747b9ad6cf467b8e80a7d4266d714e363fdbdb8 /macosx/tkMacOSXMenu.c | |
parent | 2379def90ccf62cffcb5419ab4feb419f4fc3938 (diff) | |
parent | acb6f7b259137644e34ba799e20432a0ced9be0a (diff) | |
download | tk-2d22dd5c2be401b2a9336d8e9d5e46a2c71b15f3.zip tk-2d22dd5c2be401b2a9336d8e9d5e46a2c71b15f3.tar.gz tk-2d22dd5c2be401b2a9336d8e9d5e46a2c71b15f3.tar.bz2 |
merge 8.5
Diffstat (limited to 'macosx/tkMacOSXMenu.c')
-rw-r--r-- | macosx/tkMacOSXMenu.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 7116050..380d3a7 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -683,15 +683,18 @@ TkpConfigureMenuEntry( int i = 0; NSArray *itemArray = [submenu itemArray]; for (NSMenuItem *item in itemArray) { - TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; - [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; - i++; + TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; + /* Work around an apparent bug where itemArray can have + more items than the menu's entries[] array. */ + if (i >= menuRefPtr->menuPtr->numEntries) break; + [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; + i++; } } - } } } + [menuItem setSubmenu:submenu]; return TCL_OK; |