mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-21 22:28:37 -05:00
Unix GUI: honour 'no close on exit' for connection_fatal.
It was being treated like an application-fatal message box even if you'd configured the window not to close on an unclean exit.
This commit is contained in:
parent
7cd425abab
commit
5a6608bda8
@ -224,23 +224,35 @@ static void post_fatal_message_box(void *vctx, int result)
|
|||||||
queue_toplevel_callback(post_fatal_message_box_toplevel, inst);
|
queue_toplevel_callback(post_fatal_message_box_toplevel, inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fatal_message_box(Frontend *inst, const char *msg)
|
static void common_connfatal_message_box(
|
||||||
|
Frontend *inst, const char *msg, post_dialog_fn_t postfn)
|
||||||
{
|
{
|
||||||
char *title = dupcat(appname, " Fatal Error", NULL);
|
char *title = dupcat(appname, " Fatal Error", NULL);
|
||||||
GtkWidget *dialog = create_message_box(
|
GtkWidget *dialog = create_message_box(
|
||||||
inst->window, title, msg,
|
inst->window, title, msg,
|
||||||
string_width("REASONABLY LONG LINE OF TEXT FOR BASIC SANITY"),
|
string_width("REASONABLY LONG LINE OF TEXT FOR BASIC SANITY"),
|
||||||
FALSE, &buttons_ok, post_fatal_message_box, inst);
|
FALSE, &buttons_ok, postfn, inst);
|
||||||
register_dialog(inst, DIALOG_SLOT_CONNECTION_FATAL, dialog);
|
register_dialog(inst, DIALOG_SLOT_CONNECTION_FATAL, dialog);
|
||||||
sfree(title);
|
sfree(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fatal_message_box(Frontend *inst, const char *msg)
|
||||||
|
{
|
||||||
|
common_connfatal_message_box(inst, msg, post_fatal_message_box);
|
||||||
|
}
|
||||||
|
|
||||||
static void connection_fatal_callback(void *vctx)
|
static void connection_fatal_callback(void *vctx)
|
||||||
{
|
{
|
||||||
Frontend *inst = (Frontend *)vctx;
|
Frontend *inst = (Frontend *)vctx;
|
||||||
destroy_inst_connection(inst);
|
destroy_inst_connection(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void post_nonfatal_message_box(void *vctx, int result)
|
||||||
|
{
|
||||||
|
Frontend *inst = (Frontend *)vctx;
|
||||||
|
unregister_dialog(inst, DIALOG_SLOT_CONNECTION_FATAL);
|
||||||
|
}
|
||||||
|
|
||||||
void connection_fatal(Frontend *inst, const char *p, ...)
|
void connection_fatal(Frontend *inst, const char *p, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -248,7 +260,11 @@ void connection_fatal(Frontend *inst, const char *p, ...)
|
|||||||
va_start(ap, p);
|
va_start(ap, p);
|
||||||
msg = dupvprintf(p, ap);
|
msg = dupvprintf(p, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
fatal_message_box(inst, msg);
|
if (conf_get_int(inst->conf, CONF_close_on_exit) == FORCE_ON) {
|
||||||
|
fatal_message_box(inst, msg);
|
||||||
|
} else {
|
||||||
|
common_connfatal_message_box(inst, msg, post_nonfatal_message_box);
|
||||||
|
}
|
||||||
sfree(msg);
|
sfree(msg);
|
||||||
|
|
||||||
inst->exited = TRUE; /* suppress normal exit handling */
|
inst->exited = TRUE; /* suppress normal exit handling */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user