input: don't crash when the window is resized during verbatim input
Instead of referring to a window that might have been deleted by a resize, just turn the keypad back on for the two windows from which input might have been requested. Also: don't insert KEY_WINCH as the verbatim keystroke. This fixes https://savannah.gnu.org/bugs/?48532.master
parent
1d4c1e0bfc
commit
103dd06347
15
src/winio.c
15
src/winio.c
|
@ -1375,8 +1375,12 @@ int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
|||
* keypad back on if necessary now that we're done. */
|
||||
if (ISSET(PRESERVE))
|
||||
enable_flow_control();
|
||||
if (!ISSET(REBIND_KEYPAD))
|
||||
keypad(win, TRUE);
|
||||
/* Use the global window pointers, because a resize may have freed
|
||||
* the data that the win parameter points to. */
|
||||
if (!ISSET(REBIND_KEYPAD)) {
|
||||
keypad(edit, TRUE);
|
||||
keypad(bottomwin, TRUE);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -1393,6 +1397,13 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
|||
while ((kbinput = get_input(win, 1)) == NULL)
|
||||
;
|
||||
|
||||
/* When the window was resized, abort and return nothing. */
|
||||
if (*kbinput == KEY_WINCH) {
|
||||
*kbinput_len = 0;
|
||||
free(kbinput);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
/* Check whether the first keystroke is a valid hexadecimal
|
||||
|
|
Loading…
Reference in New Issue