From bab6f1d6bf0d81c777b87f4ef21f849f7bd2cdfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 8 Aug 2019 17:57:21 +0200 Subject: [PATCH] csi: cancel selection *before* switching grid This fixes an occasional SIGSEGV --- csi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/csi.c b/csi.c index 452122f0..51eb22cb 100644 --- a/csi.c +++ b/csi.c @@ -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;