diff --git a/ssh.c b/ssh.c index 0435dd7e..7f3748af 100644 --- a/ssh.c +++ b/ssh.c @@ -2517,6 +2517,9 @@ static int ssh_closing(Plug plug, const char *error_msg, int error_code, error_msg = "Server unexpectedly closed network connection"; } + if (need_notify) + notify_remote_exit(ssh->frontend); + if (error_msg) { /* A socket error has occurred. */ logevent(error_msg); @@ -2524,8 +2527,6 @@ static int ssh_closing(Plug plug, const char *error_msg, int error_code, } else { logevent("Server closed network connection"); } - if (need_notify) - notify_remote_exit(ssh->frontend); return 0; } diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 043f519f..93cc68e9 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -1169,7 +1169,7 @@ void notify_remote_exit(void *frontend) inst->exited = TRUE; if (inst->cfg.close_on_exit == FORCE_ON || (inst->cfg.close_on_exit == AUTO && exitcode == 0)) - exit(0); /* just go. */ + gtk_main_quit(); /* just go */ if (inst->ldisc) { ldisc_free(inst->ldisc); inst->ldisc = NULL;