csi: cancel selection *before* switching grid

This fixes an occasional SIGSEGV
This commit is contained in:
Daniel Eklöf 2019-08-08 17:57:21 +02:00
parent 481a1cd678
commit bab6f1d6bf
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

7
csi.c
View file

@ -723,6 +723,8 @@ csi_dispatch(struct terminal *term, uint8_t final)
case 1049:
if (term->grid != &term->alt) {
selection_cancel(term);
term->grid = &term->alt;
term->saved_cursor = term->cursor;
@ -730,7 +732,6 @@ csi_dispatch(struct terminal *term, uint8_t final)
tll_free(term->alt.damage);
tll_free(term->alt.scroll_damage);
selection_cancel(term);
term_erase(
term,
@ -808,14 +809,14 @@ csi_dispatch(struct terminal *term, uint8_t final)
case 1049:
if (term->grid == &term->alt) {
term->grid = &term->normal;
selection_cancel(term);
term->grid = &term->normal;
term_restore_cursor(term);
tll_free(term->alt.damage);
tll_free(term->alt.scroll_damage);
selection_cancel(term);
term_damage_all(term);
}
break;