diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2010-12-10 19:23:43 +0100 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2010-12-10 19:23:43 +0100 |
commit | 0b9fc69a7651c4a36ab4616f5f7d1c2f48fed783 (patch) | |
tree | a36fb239082c71619eea44171798e2d75a5b3a6e /src | |
parent | 1f10e75066b557174bb475c735bd74a725000a4a (diff) | |
download | emacs-0b9fc69a7651c4a36ab4616f5f7d1c2f48fed783.tar.gz |
Move call to Fkill_emacs from signal handler (session event) (Bug#7552).
* keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT
as (Qsave_session arg).
* xsmfns.c (smc_interact_CB): Set arg to Qnil.
(smc_die_CB): Make an event with arg Qt.
(Fhandle_save_session): If event has Qt as argument,
call Fkill_emacs.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 10 | ||||
-rw-r--r-- | src/keyboard.c | 2 | ||||
-rw-r--r-- | src/xsmfns.c | 25 |
3 files changed, 29 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9a92697b52d..af944c32ebd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2010-12-10 Jan Djärv <jan.h.d@swipnet.se> + + * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT + as (Qsave_session arg). + + * xsmfns.c (smc_interact_CB): Set arg to Qnil. + (smc_die_CB): Make an event with arg Qt. + (Fhandle_save_session): If event has Qt as argument, + call Fkill_emacs (Bug#7552). + 2010-12-07 Jan Djärv <jan.h.d@swipnet.se> * xsmfns.c (smc_die_CB): Call Fkill_emacs (Bug#7552). diff --git a/src/keyboard.c b/src/keyboard.c index b35e4ae84e2..b027b3b09e6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4305,7 +4305,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) #endif else if (event->kind == SAVE_SESSION_EVENT) { - obj = Fcons (Qsave_session, Qnil); + obj = Fcons (Qsave_session, Fcons (event->arg, Qnil)); kbd_fetch_ptr = event + 1; } /* Just discard these, by returning nil. diff --git a/src/xsmfns.c b/src/xsmfns.c index f6260d00a56..8a16f68b255 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -172,6 +172,7 @@ smc_interact_CB (smcConn, clientData) { doing_interact = True; emacs_event.kind = SAVE_SESSION_EVENT; + emacs_event.arg = Qnil; } /* This is called when the session manager tells us to save ourselves. @@ -298,12 +299,8 @@ smc_die_CB (smcConn, clientData) SmcConn smcConn; SmPointer clientData; { - /* This may behave badly if desktop.el tries to ask questions. */ - Fkill_emacs (Qnil); - - /* This will not be reached, but we want kill-emacs-hook to be run. */ - SmcCloseConnection (smcConn, 0, 0); - ice_connection_closed (); + emacs_event.kind = SAVE_SESSION_EVENT; + emacs_event.arg = Qt; } /* We don't use the next two but they are mandatory, leave them empty. @@ -540,9 +537,12 @@ Do not call this function yourself. */) (event) Lisp_Object event; { + int kill_emacs = CONSP (event) && CONSP (XCDR (event)) + && EQ (Qt, XCAR (XCDR (event))); + /* Check doing_interact so that we don't do anything if someone called this at the wrong time. */ - if (doing_interact) + if (doing_interact && ! kill_emacs) { Bool cancel_shutdown = False; @@ -553,9 +553,20 @@ Do not call this function yourself. */) doing_interact = False; } + else if (kill_emacs) + { + /* We should not do user interaction here, but it is not easy to + prevent. Fix this in next version. */ + Fkill_emacs (Qnil); + /* This will not be reached, but we want kill-emacs-hook to be run. */ + SmcCloseConnection (smc_conn, 0, 0); + ice_connection_closed (); + } + return Qnil; } + /*********************************************************************** |