From 7413c9c2abdc3c53bbbe8bfce18b17175c6a62b3 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 22 Dec 2014 21:52:33 +0300 Subject: [PATCH] Ticket #2966: mcview: fix segfault after switch from parse to raw mode and back. Signed-off-by: Andrew Borodin --- src/viewer/growbuf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/viewer/growbuf.c b/src/viewer/growbuf.c index 8b06c6baf..a367dddeb 100644 --- a/src/viewer/growbuf.c +++ b/src/viewer/growbuf.c @@ -210,7 +210,15 @@ mcview_growbuf_read_until (mcview_t * view, off_t ofs) g_free (err_msg); } - mcview_growbuf_done (view); + if (view->ds_stdio_pipe != NULL) + { + /* when switch from parse to raw mode and back, + * do not close the already closed pipe after following loop: + * mcview_growbuf_read_until() -> mcview_show_error() -> + * MSG_DRAW -> mcview_display() -> mcview_get_byte() -> mcview_growbuf_read_until() + */ + mcview_growbuf_done (view); + } mcview_display (view); return; }