summaryrefslogtreecommitdiffstats
path: root/win/tkWinMenu.c
diff options
context:
space:
mode:
authorchengyemao <chengyemao>2005-01-18 15:24:18 (GMT)
committerchengyemao <chengyemao>2005-01-18 15:24:18 (GMT)
commit264c172a1f12285216bcc20fe2fbd7eec2582a1a (patch)
treef84343a4dc72f3e53865fdd9a725e6192cdec667 /win/tkWinMenu.c
parent53cebf2288dc3904109a8af228eb93c41b209bbb (diff)
downloadtk-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
Diffstat (limited to 'win/tkWinMenu.c')
-rw-r--r--win/tkWinMenu.c9
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);