X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=mac%2Fmacterm.c;h=d5a6014d1a2b258ab1541d6632916de6aff2f5cf;hb=8316deb3399fe1d0c406132cf2e795a76de26b64;hp=6374a1f5d15e907f3a4e42ba60277dc80da90481;hpb=abb7b4ea57eed3233e23a046c9a1cbfd5a8fa10c;p=PuTTY.git diff --git a/mac/macterm.c b/mac/macterm.c index 6374a1f5..d5a6014d 100644 --- a/mac/macterm.c +++ b/mac/macterm.c @@ -1012,14 +1012,26 @@ static pascal void mac_growtermdraghook(void) void mac_closeterm(WindowPtr window) { + int alertret; Session *s = mac_windowsession(window); - /* XXX warn on close */ + if (s->cfg.warn_on_close && !s->session_closed) { + ParamText("\pAre you sure you want to close this session?", + NULL, NULL, NULL); + alertret=CautionAlert(wQuestion, NULL); + if (alertret == 2) { + /* Cancel */ + return; + } + } + HideWindow(s->window); *s->prev = s->next; s->next->prev = s->prev; - ldisc_free(s->ldisc); - s->back->free(s->backhandle); + if (s->ldisc) + ldisc_free(s->ldisc); + if (s->back) + s->back->free(s->backhandle); log_free(s->logctx); if (s->uni_to_font != NULL) DisposeUnicodeToTextInfo(&s->uni_to_font); @@ -1865,7 +1877,8 @@ void frontend_keypress(void *handle) * Ask whether to wipe a session log file before writing to it. * Returns 2 for wipe, 1 for append, 0 for cancel (don't log). */ -int askappend(void *frontend, Filename filename) +int askappend(void *frontend, Filename filename, + void (*callback)(void *ctx, int result), void *ctx) { /* FIXME: not implemented yet. */