diff options
author | culler <culler> | 2019-02-10 18:26:14 (GMT) |
---|---|---|
committer | culler <culler> | 2019-02-10 18:26:14 (GMT) |
commit | e428446dc898701833ac31c1d064c50e573bdb81 (patch) | |
tree | 51e1adc5244c619f26c554509ef43d3e67d3d277 /macosx | |
parent | a9e9a66f972c679eaf82fe93243d55a9cf4e46db (diff) | |
parent | 90820ca6b9ac0083411f842c8b137fc6648c47c6 (diff) | |
download | tk-e428446dc898701833ac31c1d064c50e573bdb81.zip tk-e428446dc898701833ac31c1d064c50e573bdb81.tar.gz tk-e428446dc898701833ac31c1d064c50e573bdb81.tar.bz2 |
Fix bug [8814bddf5d]: segfault in [NSMenu size]
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXMenu.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 316a8d7..227c379 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -1038,8 +1038,8 @@ TkpSetMainMenubar( * CheckForSpecialMenu -- * * Given a menu, check to see whether or not it is a cascade in a menubar - * with one of the special names .apple, .help or .window If it is, the - * entry that points to this menu will be marked. + * with one of the special names ".apple", ".help" or ".window". If it + * is, the entry that points to this menu will be marked. * * Results: * None. @@ -1216,7 +1216,7 @@ void TkpComputeStandardMenuGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { - NSSize menuSize = [(NSMenu *)menuPtr->platformData size]; + NSSize menuSize; Tk_Font tkfont, menuFont; Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int modifierCharWidth, menuModifierCharWidth; @@ -1227,10 +1227,14 @@ TkpComputeStandardMenuGeometry( TkMenuEntry *mePtr; int haveAccel = 0; - if (menuPtr->tkwin == NULL) { + /* + * Do nothing if this menu is a clone. + */ + if (menuPtr->tkwin == NULL || menuPtr->masterMenuPtr != menuPtr) { return; } - + + menuSize = [(NSMenu *)menuPtr->platformData size]; Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, &borderWidth); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, |