[Top][All Lists]

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

Re: C-g crash redux

From: Chong Yidong
Subject: Re: C-g crash redux
Date: Fri, 04 Aug 2006 12:03:07 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Chong Yidong <address@hidden> writes:

> Another approach, which may be less risky, is to protect the portions
> of code in read_char where getcjmp is active.  We should then be able
> to safely use unwind protects inside wait_reading_process_output.

The previous code suggestion I gave was not well thought out.  The
correct way to implement this is as follows.  I've checked that with
this change, the addition of wait_reading_process_output_unwind does
not cause a crash when C-g is done during sit-for.

Do you think this is the right approach?

*** emacs/src/keyboard.c.~1.862.~       2006-08-01 11:00:25.000000000 -0400
--- emacs/src/keyboard.c        2006-08-04 12:00:29.000000000 -0400
*** 2413,2418 ****
--- 2413,2419 ----
    volatile int reread;
    struct gcpro gcpro1, gcpro2;
    int polling_stopped_here = 0;
+   int jmpcount;
    also_record = Qnil;
*** 2629,2639 ****
--- 2630,2642 ----
       around any call to sit_for or kbd_buffer_get_event;
       it *must not* be in effect when we call redisplay.  */
+   jmpcount = SPECPDL_INDEX ();
    if (_setjmp (local_getcjmp))
        /* We must have saved the outer value of getcjmp here,
         so restore it now.  */
        restore_getcjmp (save_jump);
+       unbind_to (jmpcount, Qnil);
        XSETINT (c, quit_char);
        internal_last_event_frame = selected_frame;
        Vlast_event_frame = internal_last_event_frame;

reply via email to

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