degesch: make a second SIGINT force-quit
Also fixed the possibility of eating a sequence of signals as we reset the indicators /after/ we took action, which creates a time window for races.
This commit is contained in:
parent
2336340ad8
commit
d05c85833d
25
degesch.c
25
degesch.c
@ -5021,14 +5021,17 @@ irc_initiate_disconnect (struct server *s, const char *reason)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initiate_quit (struct app_context *ctx, const char *message)
|
request_quit (struct app_context *ctx, const char *message)
|
||||||
{
|
{
|
||||||
log_global_status (ctx, "Shutting down");
|
if (!ctx->quitting)
|
||||||
|
{
|
||||||
|
log_global_status (ctx, "Shutting down");
|
||||||
|
ctx->quitting = true;
|
||||||
|
|
||||||
// Hide the user interface
|
// Disable the user interface
|
||||||
CALL (ctx->input, hide);
|
CALL (ctx->input, hide);
|
||||||
|
}
|
||||||
|
|
||||||
// Initiate a connection close
|
|
||||||
struct str_map_iter iter = str_map_iter_make (&ctx->servers);
|
struct str_map_iter iter = str_map_iter_make (&ctx->servers);
|
||||||
struct server *s;
|
struct server *s;
|
||||||
while ((s = str_map_iter_next (&iter)))
|
while ((s = str_map_iter_next (&iter)))
|
||||||
@ -5042,7 +5045,6 @@ initiate_quit (struct app_context *ctx, const char *message)
|
|||||||
irc_destroy_connector (s);
|
irc_destroy_connector (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->quitting = true;
|
|
||||||
try_finish_quit (ctx);
|
try_finish_quit (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11280,7 +11282,7 @@ handle_command_me (struct handler_args *a)
|
|||||||
static bool
|
static bool
|
||||||
handle_command_quit (struct handler_args *a)
|
handle_command_quit (struct handler_args *a)
|
||||||
{
|
{
|
||||||
initiate_quit (a->ctx, *a->arguments ? a->arguments : NULL);
|
request_quit (a->ctx, *a->arguments ? a->arguments : NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13722,12 +13724,15 @@ on_signal_pipe_readable (const struct pollfd *fd, struct app_context *ctx)
|
|||||||
while (try_reap_child (ctx))
|
while (try_reap_child (ctx))
|
||||||
;
|
;
|
||||||
|
|
||||||
if (g_termination_requested && !ctx->quitting)
|
if (g_termination_requested)
|
||||||
initiate_quit (ctx, NULL);
|
{
|
||||||
|
g_termination_requested = false;
|
||||||
|
request_quit (ctx, NULL);
|
||||||
|
}
|
||||||
if (g_winch_received)
|
if (g_winch_received)
|
||||||
{
|
{
|
||||||
redraw_screen (ctx);
|
|
||||||
g_winch_received = false;
|
g_winch_received = false;
|
||||||
|
redraw_screen (ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user