diff options
author | chengyemao <chengyemao> | 2005-01-18 15:24:18 (GMT) |
---|---|---|
committer | chengyemao <chengyemao> | 2005-01-18 15:24:18 (GMT) |
commit | 264c172a1f12285216bcc20fe2fbd7eec2582a1a (patch) | |
tree | f84343a4dc72f3e53865fdd9a725e6192cdec667 | |
parent | 53cebf2288dc3904109a8af228eb93c41b209bbb (diff) | |
download | tk-264c172a1f12285216bcc20fe2fbd7eec2582a1a.zip tk-264c172a1f12285216bcc20fe2fbd7eec2582a1a.tar.gz tk-264c172a1f12285216bcc20fe2fbd7eec2582a1a.tar.bz2 |
Fixed a bug by adding code the check menu index in selection. This bug caused an access violation in an embedded menu testing when the mouse clicked the last pull-down menu entry
-rw-r--r-- | win/tkWinMenu.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index ef881e0..766e3c3 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinMenu.c,v 1.42 2005/01/17 07:00:11 chengyemao Exp $ + * RCS: @(#) $Id: tkWinMenu.c,v 1.43 2005/01/18 15:24:18 chengyemao Exp $ */ #define OEMRESOURCE @@ -1237,14 +1237,15 @@ TkWinHandleMenuEvent(phwnd, pMessage, pwParam, plParam, plResult) } if (menuPtr != NULL) { + long entryIndex = LOWORD(*pwParam); mePtr = NULL; - if (flags != 0xFFFF) { + if (flags != 0xFFFF && entryIndex < menuPtr->numEntries) { if (flags & MF_POPUP) { - mePtr = menuPtr->entries[LOWORD(*pwParam)]; + mePtr = menuPtr->entries[entryIndex]; } else { hashEntryPtr = Tcl_FindHashEntry( &tsdPtr->commandTable, - (char *) LOWORD(*pwParam)); + (char *) entryIndex); if (hashEntryPtr != NULL) { mePtr = (TkMenuEntry *) Tcl_GetHashValue(hashEntryPtr); |