bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63058: 28.2; Emacs is terminated by Windows when logging off even if


From: Harald Sanftmann
Subject: bug#63058: 28.2; Emacs is terminated by Windows when logging off even if modified buffers are open
Date: Mon, 24 Apr 2023 17:48:59 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

Hi everybody,


From time to time it happens that I have not closed Emacs before
logging out. Windows just terminates the process even if modified
buffers are open.

I searched for a solution and learned how Windows is telling
applications to prepare for the user logging off / Windows is shutting
down:
https://www.howtogeek.com/396277/what-exactly-happens-when-you-shut-down-or-sign-out-of-windows/

WM_QUERYENDSESSION and WM_ENDSESSION are the sent signals, if the
application does not respond it will be terminated after 5 seconds.

Then I found some code which could be the Emacs implementation:


https://github.com/emacs-mirror/emacs/blob/master/src/w32fns.c

      switch (msg)
        {
        case WM_ERASEBKGND:
           ...
        case WM_ENDSESSION:
        my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
        /* Allow time for Emacs to attempt an orderly shutdown.  If we
           return, the process will be terminated immediately.  FIXME:
           1000 seconds is too long to sleep if the shutdown attempt
           fails (see bug#25875).  But if it fails, we want to find out
           about it, so let's leave 1000 for now.  */
        sleep (1000);
        FALLTHROUGH;

Seems like Emacs does not respond but sleeps for 1000 s. This will
probably not cut it.

Would be great to have a proper handling.

Thanks & Reards,
Harald


In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
 of 2022-09-13 built on AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.22621
System Description: Microsoft Windows 10 Pro (v10.0.2009.22621.1555)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation
 --without-compress-install CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
XPM ZLIB

(NATIVE_COMP present but libgccjit not available)

Important settings:
  value of $LANG: DEU
  locale-coding-system: cp1252

Major mode: Org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]