aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2010-12-10 19:23:43 +0100
committerJan Djärv2010-12-10 19:23:43 +0100
commit0b9fc69a7651c4a36ab4616f5f7d1c2f48fed783 (patch)
treea36fb239082c71619eea44171798e2d75a5b3a6e /src
parent1f10e75066b557174bb475c735bd74a725000a4a (diff)
downloademacs-0b9fc69a7651c4a36ab4616f5f7d1c2f48fed783.tar.gz
emacs-0b9fc69a7651c4a36ab4616f5f7d1c2f48fed783.zip
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/ChangeLog10
-rw-r--r--src/keyboard.c2
-rw-r--r--src/xsmfns.c25
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 @@
12010-12-10 Jan Djärv <jan.h.d@swipnet.se>
2
3 * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT
4 as (Qsave_session arg).
5
6 * xsmfns.c (smc_interact_CB): Set arg to Qnil.
7 (smc_die_CB): Make an event with arg Qt.
8 (Fhandle_save_session): If event has Qt as argument,
9 call Fkill_emacs (Bug#7552).
10
12010-12-07 Jan Djärv <jan.h.d@swipnet.se> 112010-12-07 Jan Djärv <jan.h.d@swipnet.se>
2 12
3 * xsmfns.c (smc_die_CB): Call Fkill_emacs (Bug#7552). 13 * 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)
4305#endif 4305#endif
4306 else if (event->kind == SAVE_SESSION_EVENT) 4306 else if (event->kind == SAVE_SESSION_EVENT)
4307 { 4307 {
4308 obj = Fcons (Qsave_session, Qnil); 4308 obj = Fcons (Qsave_session, Fcons (event->arg, Qnil));
4309 kbd_fetch_ptr = event + 1; 4309 kbd_fetch_ptr = event + 1;
4310 } 4310 }
4311 /* Just discard these, by returning nil. 4311 /* 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)
172{ 172{
173 doing_interact = True; 173 doing_interact = True;
174 emacs_event.kind = SAVE_SESSION_EVENT; 174 emacs_event.kind = SAVE_SESSION_EVENT;
175 emacs_event.arg = Qnil;
175} 176}
176 177
177/* This is called when the session manager tells us to save ourselves. 178/* This is called when the session manager tells us to save ourselves.
@@ -298,12 +299,8 @@ smc_die_CB (smcConn, clientData)
298 SmcConn smcConn; 299 SmcConn smcConn;
299 SmPointer clientData; 300 SmPointer clientData;
300{ 301{
301 /* This may behave badly if desktop.el tries to ask questions. */ 302 emacs_event.kind = SAVE_SESSION_EVENT;
302 Fkill_emacs (Qnil); 303 emacs_event.arg = Qt;
303
304 /* This will not be reached, but we want kill-emacs-hook to be run. */
305 SmcCloseConnection (smcConn, 0, 0);
306 ice_connection_closed ();
307} 304}
308 305
309/* We don't use the next two but they are mandatory, leave them empty. 306/* We don't use the next two but they are mandatory, leave them empty.
@@ -540,9 +537,12 @@ Do not call this function yourself. */)
540 (event) 537 (event)
541 Lisp_Object event; 538 Lisp_Object event;
542{ 539{
540 int kill_emacs = CONSP (event) && CONSP (XCDR (event))
541 && EQ (Qt, XCAR (XCDR (event)));
542
543 /* Check doing_interact so that we don't do anything if someone called 543 /* Check doing_interact so that we don't do anything if someone called
544 this at the wrong time. */ 544 this at the wrong time. */
545 if (doing_interact) 545 if (doing_interact && ! kill_emacs)
546 { 546 {
547 Bool cancel_shutdown = False; 547 Bool cancel_shutdown = False;
548 548
@@ -553,9 +553,20 @@ Do not call this function yourself. */)
553 553
554 doing_interact = False; 554 doing_interact = False;
555 } 555 }
556 else if (kill_emacs)
557 {
558 /* We should not do user interaction here, but it is not easy to
559 prevent. Fix this in next version. */
560 Fkill_emacs (Qnil);
556 561
562 /* This will not be reached, but we want kill-emacs-hook to be run. */
563 SmcCloseConnection (smc_conn, 0, 0);
564 ice_connection_closed ();
565 }
566
557 return Qnil; 567 return Qnil;
558} 568}
569
559 570
560 571
561/*********************************************************************** 572/***********************************************************************