From bdbc4b33f0ff6f1f9c9ecf3b2a836337d0063b9d Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Fri, 8 May 2015 04:28:27 +0200
Subject: degesch: prevent segfault on exit with libedit
---
degesch.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/degesch.c b/degesch.c
index 95855cb..eb3c27a 100644
--- a/degesch.c
+++ b/degesch.c
@@ -5727,7 +5727,10 @@ on_tty_readable (const struct pollfd *fd, struct app_context *ctx)
if (fd->revents & ~(POLLIN | POLLHUP | POLLERR))
print_debug ("fd %d: unexpected revents: %d", fd->fd, fd->revents);
- input_on_readable (&ctx->input);
+ // XXX: this may loop for a bit: stop the event or eat the input?
+ // (This prevents a segfault when the input has been stopped.)
+ if (ctx->input.active)
+ input_on_readable (&ctx->input);
}
// --- Configuration loading ---------------------------------------------------
--
cgit v1.2.3-70-g09d2