aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
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;