From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: C-g crash redux Date: Fri, 04 Aug 2006 12:03:07 -0400 Message-ID: <874pwsebes.fsf@stupidchicken.com> References: <877j1qvp4k.fsf@pacem.orebokech.com> <17617.8764.824445.882539@kahikatea.snap.net.nz> <87fygd97j0.fsf@stupidchicken.com> <87zmelfihg.fsf@stupidchicken.com> <877j1owmhx.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1154707598 1601 80.91.229.2 (4 Aug 2006 16:06:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 4 Aug 2006 16:06:38 +0000 (UTC) Cc: Nick Roberts , Romain Francoise , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 04 18:06:12 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G92Bd-0000s1-3g for ged-emacs-devel@m.gmane.org; Fri, 04 Aug 2006 18:06:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G92Bc-0001B7-71 for ged-emacs-devel@m.gmane.org; Fri, 04 Aug 2006 12:06:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G927k-0007qH-Mu for emacs-devel@gnu.org; Fri, 04 Aug 2006 12:02:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G927j-0007pG-Ki for emacs-devel@gnu.org; Fri, 04 Aug 2006 12:02:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G927i-0007oR-Ue for emacs-devel@gnu.org; Fri, 04 Aug 2006 12:02:06 -0400 Original-Received: from [18.19.1.138] (helo=cyd) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G92BJ-0000ms-IU for emacs-devel@gnu.org; Fri, 04 Aug 2006 12:05:49 -0400 Original-Received: by cyd (Postfix, from userid 1000) id DD8624E2CC; Fri, 4 Aug 2006 12:03:07 -0400 (EDT) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: <877j1owmhx.fsf@stupidchicken.com> (Chong Yidong's message of "Fri, 04 Aug 2006 11:26:18 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58097 Archived-At: Chong Yidong 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;