aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-04-18 16:10:11 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-04-18 16:10:11 +0200
commite65b38bff9100908f8be8a8391ca025c1120a618 (patch)
treeedc1adcaf0389cfb9e44eace9b2875b9ec3c2b01 /degesch.c
parent932548ef4b440d1537b097d1317e7723c5534f51 (diff)
downloadxK-e65b38bff9100908f8be8a8391ca025c1120a618.tar.gz
xK-e65b38bff9100908f8be8a8391ca025c1120a618.tar.xz
xK-e65b38bff9100908f8be8a8391ca025c1120a618.zip
degesch: readline cleanup
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c12
1 files 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;