Tk Source Code

Artifact [8faf094f]
Login

Artifact 8faf094fd9b037ca504f41f26e188550f7c7bbc5:

Attachment "tkWinMenu_tk84.diff" to ticket [1192095f] added by wildcard_25 2005-05-01 10:20:53.
Index: win/tkWinMenu.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/win/tkWinMenu.c,v
retrieving revision 1.21.2.4
diff -u -d -r1.21.2.4 tkWinMenu.c
--- win/tkWinMenu.c	27 Oct 2004 00:37:38 -0000	1.21.2.4
+++ win/tkWinMenu.c	1 May 2005 02:40:19 -0000
@@ -1155,14 +1155,16 @@
 		}
 
 		if (menuPtr != NULL) {
+		    long entryIndex = LOWORD(*pwParam);
+		    if (menuPtr->menuType == MENUBAR) { entryIndex++; }
 	    	    mePtr = NULL;
 		    if (flags != 0xFFFF) {
-			if (flags & MF_POPUP) {
-			    mePtr = menuPtr->entries[LOWORD(*pwParam)];
+			if ((flags & MF_POPUP) && (entryIndex < menuPtr->numEntries)) {
+			    mePtr = menuPtr->entries[entryIndex];
 			} else {
 			    hashEntryPtr = Tcl_FindHashEntry(
                                     &tsdPtr->commandTable,
-				    (char *) LOWORD(*pwParam));
+				    (char *) entryIndex);
 			    if (hashEntryPtr != NULL) {
 				mePtr = (TkMenuEntry *) 
 					Tcl_GetHashValue(hashEntryPtr);