summaryrefslogtreecommitdiffstats
path: root/win/tkWinMenu.c
diff options
context:
space:
mode:
authorchengyemao <chengyemao@noemail.net>2005-01-18 15:24:18 (GMT)
committerchengyemao <chengyemao@noemail.net>2005-01-18 15:24:18 (GMT)
commita4d9adaf7cc055f161ca7279f25ecc350be82747 (patch)
treef84343a4dc72f3e53865fdd9a725e6192cdec667 /win/tkWinMenu.c
parentfdac4595a9912fb04bfec6bc7fefb67fd6b33b6e (diff)
downloadtk-a4d9adaf7cc055f161ca7279f25ecc350be82747.zip
tk-a4d9adaf7cc055f161ca7279f25ecc350be82747.tar.gz
tk-a4d9adaf7cc055f161ca7279f25ecc350be82747.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
FossilOrigin-Name: 1d75b685575dae184e96a2217b0fcfef487f8c7c
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);