degesch: readline cleanup

This commit is contained in:
Přemysl Eric Janouch 2015-04-18 16:10:11 +02:00
parent 932548ef4b
commit e65b38bff9

View File

@ -1060,6 +1060,9 @@ initiate_quit (struct app_context *ctx)
ctx->readline_prompt_shown = false; 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 // Initiate a connection close
buffer_send_status (ctx, ctx->global_buffer, "shutting down"); buffer_send_status (ctx, ctx->global_buffer, "shutting down");
if (ctx->irc_fd != -1) if (ctx->irc_fd != -1)
@ -2290,10 +2293,8 @@ on_readline_input (char *line)
rl_ding (); rl_ding ();
} }
if (g_ctx->quitting) // initiate_quit() disables readline; we just wait then
rl_callback_handler_remove (); if (!g_ctx->quitting)
else
// initiate_quit() disables readline; we just wait then
g_ctx->readline_prompt_shown = true; g_ctx->readline_prompt_shown = true;
} }
@ -2626,9 +2627,6 @@ main (int argc, char *argv[])
while (ctx.polling) while (ctx.polling)
poller_run (&ctx.poller); poller_run (&ctx.poller);
if (ctx.readline_prompt_shown)
rl_callback_handler_remove ();
app_context_free (&ctx); app_context_free (&ctx);
free_terminal (); free_terminal ();
return EXIT_SUCCESS; return EXIT_SUCCESS;