diff options
author | Kevin Walzer <kw@codebykevin.com> | 2014-08-01 01:00:52 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2014-08-01 01:00:52 (GMT) |
commit | 0d3d470ae6293a49c5bdfb878c5d569ab32e6470 (patch) | |
tree | c21ad9e9f59f9ef119ff2266b5611a7ab44029f6 | |
parent | 40d0c308183653423bfe716b4a597105fdef7dc9 (diff) | |
download | tk-0d3d470ae6293a49c5bdfb878c5d569ab32e6470.zip tk-0d3d470ae6293a49c5bdfb878c5d569ab32e6470.tar.gz tk-0d3d470ae6293a49c5bdfb878c5d569ab32e6470.tar.bz2 |
Fix for font configure crash on OS X, thanks to rob@bitkeeper.com for the patch
-rw-r--r-- | macosx/tkMacOSXDraw.c | 3 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 11 |
2 files changed, 8 insertions, 6 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 5512669..6ec3e59 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -1542,7 +1542,7 @@ TkScrollWindow( frame.origin.x - macDraw->xOff + dx, (bounds.size.height - frame.origin.y - frame.size.height) - macDraw->yOff + dy, frame.size.width, frame.size.height); - /* Rectangles with negative coordinates seem to cause trouble. */ + // /* Rectangles with negative coordinates seem to cause trouble. */ if (subviewRect.origin.y < 0 && subviewRect.origin.y + subviewRect.size.height > 0) { subviewRect.origin.y = 0; } @@ -1553,7 +1553,6 @@ TkScrollWindow( CFRelease(dstRgn); } } - } } 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; |