summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXMenu.c
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2014-08-01 01:00:52 (GMT)
committerKevin Walzer <kw@codebykevin.com>2014-08-01 01:00:52 (GMT)
commita53043ff3a732cffd15c303124f3fb397c9a5c18 (patch)
treefeaaa3a0e7828953da735369b27fc47d5f114287 /macosx/tkMacOSXMenu.c
parentc5695e766b9c40219e9280af36c65998d30e6eb7 (diff)
downloadtk-a53043ff3a732cffd15c303124f3fb397c9a5c18.zip
tk-a53043ff3a732cffd15c303124f3fb397c9a5c18.tar.gz
tk-a53043ff3a732cffd15c303124f3fb397c9a5c18.tar.bz2
Fix for font configure crash on OS X, thanks to rob@bitkeeper.com for the patch
Diffstat (limited to 'macosx/tkMacOSXMenu.c')
-rw-r--r--macosx/tkMacOSXMenu.c11
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;