Fix uninitialized memory use in key-down events on window activation

This commit is contained in:
Campbell Barton 2022-06-29 18:21:36 +10:00 committed by Thomas Dinges
parent e4df7fcf76
commit 45763272c5
Notes: blender-bot 2023-02-14 07:30:31 +01:00
Referenced by issue #98661, 3.2: Potential candidates for corrective releases
1 changed files with 6 additions and 4 deletions

View File

@ -1115,7 +1115,6 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
break;
case GHOST_kEventWindowActivate: {
GHOST_TEventKeyData kdata;
const int keymodifier = ((query_qual(SHIFT) ? KM_SHIFT : 0) |
(query_qual(CONTROL) ? KM_CTRL : 0) |
(query_qual(ALT) ? KM_ALT : 0) | (query_qual(OS) ? KM_OSKEY : 0));
@ -1138,9 +1137,12 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
*
* For now don't send GHOST_kEventKeyDown events, just set the 'eventstate'.
*/
kdata.ascii = '\0';
kdata.utf8_buf[0] = '\0';
GHOST_TEventKeyData kdata = {
.key = GHOST_kKeyUnknown,
.ascii = '\0',
.utf8_buf = {'\0'},
.is_repeat = false,
};
if (win->eventstate->modifier & KM_SHIFT) {
if ((keymodifier & KM_SHIFT) == 0) {
kdata.key = GHOST_kKeyLeftShift;