unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ken Brown <kbrown@cornell.edu>
Cc: strozzi2@llnl.gov, 23483@debbugs.gnu.org
Subject: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
Date: Tue, 10 May 2016 19:32:26 +0300	[thread overview]
Message-ID: <83y47hc1r9.fsf@gnu.org> (raw)
In-Reply-To: <d23d49e3-837e-6990-f95d-b7d4922fa915@cornell.edu> (message from Ken Brown on Tue, 10 May 2016 11:16:44 -0400)

> Cc: 23483@debbugs.gnu.org
> From: Ken Brown <kbrown@cornell.edu>
> Date: Tue, 10 May 2016 11:16:44 -0400
> 
> > If someone submits patches that listen to system shutdown messages,
> > and auto-save files when they arrive, this can be fixed.  Patches
> > welcome.
> 
> I asked about this on the Cygwin list (https://www.cygwin.com/ml/cygwin/2016-05/msg00085.html).  Based on the response I got, I tried the following, which seems to work:
> 
> diff --git a/src/w32fns.c b/src/w32fns.c
> index ede8f6b..705b978 100644
> --- a/src/w32fns.c
> +++ b/src/w32fns.c
> @@ -4795,6 +4795,9 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
>        my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
>        return 0;
> 
> +    case WM_ENDSESSION:
> +      terminate_due_to_signal (SIGTERM, 0);
> +

Thanks.

However, w32_wnd_proc runs in a separate thread, so I don't think you
can safely call terminate_due_to_signal from there, because the latter
will call Lisp.  IOW, the above can crash in "interesting" ways.

What I think we need to do instead is send a message to the main
thread that will produce a special event, and then bind that event to
kill-emacs (probably in special-event-map).





  reply	other threads:[~2016-05-10 16:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-08 13:33 bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down Strozzi, David J.
2016-05-08 18:40 ` Eli Zaretskii
2016-05-10 15:16   ` Ken Brown
2016-05-10 16:32     ` Eli Zaretskii [this message]
2016-05-12 13:57       ` Ken Brown
2016-05-12 16:56         ` Eli Zaretskii
2016-05-12 19:58           ` Ken Brown
2016-05-13 16:22             ` Strozzi, David J.
2016-05-13 17:46               ` Eli Zaretskii
2016-05-13 18:05                 ` Ken Brown
2016-05-13 20:02                 ` Strozzi, David J.
2016-05-13 23:12                   ` Ken Brown
2016-05-14  7:56                     ` Eli Zaretskii
2016-05-14  7:22                   ` Eli Zaretskii
2016-05-14 20:02                     ` Strozzi, David J.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y47hc1r9.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=23483@debbugs.gnu.org \
    --cc=kbrown@cornell.edu \
    --cc=strozzi2@llnl.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).