diff options
author | patthoyts@users.sourceforge.net <patthoyts> | 2009-05-21 22:52:06 (GMT) |
---|---|---|
committer | patthoyts@users.sourceforge.net <patthoyts> | 2009-05-21 22:52:06 (GMT) |
commit | 70f4bac5bee0ac2a31a0105bbd2b84a464db6611 (patch) | |
tree | e391b7ce54b3be4e79d38211fd3d587492c9d7a1 /win | |
parent | 236f543236bf5cd5a6f09a65fda628ec25422b56 (diff) | |
download | tk-70f4bac5bee0ac2a31a0105bbd2b84a464db6611.zip tk-70f4bac5bee0ac2a31a0105bbd2b84a464db6611.tar.gz tk-70f4bac5bee0ac2a31a0105bbd2b84a464db6611.tar.bz2 |
[Bug 2794778]: Calls to CallWindowProc can lead to other functions
overwriting the event strucure. Therefore preserve a local copy of the
XKeyEvent while looping over the key events.
Diffstat (limited to 'win')
-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 1a54fd7..1909f34 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -10,7 +10,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.66 2009/03/25 23:39:35 nijtmans Exp $ + * RCS: @(#) $Id: tkWinMenu.c,v 1.67 2009/05/21 22:52:06 patthoyts Exp $ */ #define OEMRESOURCE @@ -1982,14 +1982,15 @@ TkWinMenuKeyObjCmd( virtualKey = XKeysymToKeycode(winPtr->display, keySym); scanCode = MapVirtualKey(virtualKey, 0); if (0 != scanCode) { + XKeyEvent xkey = eventPtr->xkey; CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYDOWN, virtualKey, (int) ((scanCode << 16) | (1 << 29))); - if (eventPtr->xkey.nbytes > 0) { - for (i = 0; i < eventPtr->xkey.nbytes; i++) { + if (xkey.nbytes > 0) { + for (i = 0; i < xkey.nbytes; i++) { CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR, - eventPtr->xkey.trans_chars[i], + xkey.trans_chars[i], (int) ((scanCode << 16) | (1 << 29))); } } |