From e65b38bff9100908f8be8a8391ca025c1120a618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sat, 18 Apr 2015 16:10:11 +0200 Subject: [PATCH] degesch: readline cleanup --- degesch.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/degesch.c b/degesch.c index 4c5afbb..c5e94b9 100644 --- a/degesch.c +++ b/degesch.c @@ -1060,6 +1060,9 @@ initiate_quit (struct app_context *ctx) ctx->readline_prompt_shown = false; } + // This is okay as long as we're not called from within readline + rl_callback_handler_remove (); + // Initiate a connection close buffer_send_status (ctx, ctx->global_buffer, "shutting down"); if (ctx->irc_fd != -1) @@ -2290,10 +2293,8 @@ on_readline_input (char *line) rl_ding (); } - if (g_ctx->quitting) - rl_callback_handler_remove (); - else - // initiate_quit() disables readline; we just wait then + // initiate_quit() disables readline; we just wait then + if (!g_ctx->quitting) g_ctx->readline_prompt_shown = true; } @@ -2626,9 +2627,6 @@ main (int argc, char *argv[]) while (ctx.polling) poller_run (&ctx.poller); - if (ctx.readline_prompt_shown) - rl_callback_handler_remove (); - app_context_free (&ctx); free_terminal (); return EXIT_SUCCESS;