From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#10955: 24.0.94; Closing Speedbar frame raises error Date: Tue, 06 Mar 2012 16:36:17 +0100 Message-ID: <4F562EF1.8060701@gmx.at> References: <871up6kn8c.fsf@escher.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020806040703060601000208" X-Trace: dough.gmane.org 1331048274 12402 80.91.229.3 (6 Mar 2012 15:37:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2012 15:37:54 +0000 (UTC) Cc: 10955@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 06 16:37:53 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S4wSP-0007uQ-40 for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Mar 2012 16:37:45 +0100 Original-Received: from localhost ([::1]:58259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4wSO-000223-97 for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Mar 2012 10:37:44 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4wSL-00021o-0m for bug-gnu-emacs@gnu.org; Tue, 06 Mar 2012 10:37:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4wSJ-0002rN-12 for bug-gnu-emacs@gnu.org; Tue, 06 Mar 2012 10:37:40 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4wSI-0002rH-TL for bug-gnu-emacs@gnu.org; Tue, 06 Mar 2012 10:37:38 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S4wSf-0000Uc-Sw for bug-gnu-emacs@gnu.org; Tue, 06 Mar 2012 10:38:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Mar 2012 15:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10955 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10955-submit@debbugs.gnu.org id=B10955.13310482341825 (code B ref 10955); Tue, 06 Mar 2012 15:38:01 +0000 Original-Received: (at 10955) by debbugs.gnu.org; 6 Mar 2012 15:37:14 +0000 Original-Received: from localhost ([127.0.0.1]:36058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S4wRu-0000TA-7F for submit@debbugs.gnu.org; Tue, 06 Mar 2012 10:37:14 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:42758) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S4wRh-0000SL-0s for 10955@debbugs.gnu.org; Tue, 06 Mar 2012 10:37:02 -0500 Original-Received: (qmail invoked by alias); 06 Mar 2012 15:36:06 -0000 Original-Received: from 62-47-61-71.adsl.highway.telekom.at (EHLO [62.47.61.71]) [62.47.61.71] by mail.gmx.net (mp069) with SMTP; 06 Mar 2012 16:36:06 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+y3w9efTiy79ApfTuoc3W/o37gi0kv+EdY3vxRdC vvQFLguSbdSuRx In-Reply-To: <871up6kn8c.fsf@escher.home> X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57535 Archived-At: This is a multi-part message in MIME format. --------------020806040703060601000208 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > 0. emacs -Q > 1. Check "Enter Debugger on Error" in the Options menu. > 2. M-x speedbar > 3. With the Speedbar frame selected, type `q'. > =>The Speedbar frame vanishes, and in the remaining frame, the following > backtrace appears: > > Debugger entered--Lisp error: (error "Attempt to delete the sole visible or iconified frame") > delete-frame(#) > window--delete(# t t) > replace-buffer-in-windows(#) > kill-buffer(#) > dframe-close-frame() > call-interactively(dframe-close-frame nil nil) > > No error is raised if steps 0-2 are repeated and at step 3 `Q' > (delete-frame) is typed. > > Note that the frame consists of a single window containing the > *Backtrace* buffer (normally, a backtrace splits the window). Moreover, > typing `q' (top-level) in this buffer deletes the backtrace, but an > empty *Backtrace* buffer remains as the current buffer (normally, `q' > kills the *Backtrace* buffer.) At the time `window--delete' is called the speedbar frame is invisible (you should be able to verify this by calling (frame-visible-p (window-frame window)) right at the beginning of `window--delete'). `dframe-frame-mode' has (make-frame-invisible (symbol-value frame-var)))) and so we have found someone responsible for this behavior. Now there's nothing wrong with making a frame invisible and then trying to delete it. What happens, however, is that `delete-frame' is determined to delete a frame if and only if there are "other visible frames" which sounds like a reasonable condition. Unfortunately, it's implementation seems wrong. Look at the code below called for the invisible frame f: other_visible_frames (FRAME_PTR f) { /* We know the selected frame is visible, so if F is some other frame, it can't be the sole visible one. */ if (f == SELECTED_FRAME ()) <---- f is selected, so we take this { Lisp_Object frames; int count = 0; <---- we set this to zero for (frames = Vframe_list; <---- there are two frames, a visible and an invisible one CONSP (frames); frames = XCDR (frames)) { Lisp_Object this; this = XCAR (frames); /* Verify that the frame's window still exists and we can still talk to it. And note any recent change in visibility. */ #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (XFRAME (this))) { x_sync (XFRAME (this)); FRAME_SAMPLE_VISIBILITY (XFRAME (this)); } #endif if (FRAME_VISIBLE_P (XFRAME (this)) <---- Neither of these three disjuncts holds for f || FRAME_ICONIFIED_P (XFRAME (this)) /* Allow deleting the terminal frame when at least one X frame exists! */ || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f))) count++; <---- incremented once only, for the sole visible frame } return count > 1; <---- fails since count == 1 } return 1; } So this code makes it impossible to delete an invisible (or iconified) frame if it's selected and there is only one other visible frame. The attached patch should fix this but I'm not very sure whether it's correct. martin --------------020806040703060601000208 Content-Type: text/plain; name="frame.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="frame.c.diff" === modified file 'src/frame.c' --- src/frame.c 2012-01-19 07:21:25 +0000 +++ src/frame.c 2012-03-06 15:18:55 +0000 @@ -1143,14 +1143,15 @@ } #endif - if (FRAME_VISIBLE_P (XFRAME (this)) - || FRAME_ICONIFIED_P (XFRAME (this)) - /* Allow deleting the terminal frame when at least - one X frame exists! */ - || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f))) + if (f != XFRAME (this) + && (FRAME_VISIBLE_P (XFRAME (this)) + || FRAME_ICONIFIED_P (XFRAME (this)) + /* Allow deleting the terminal frame when at least + one X frame exists! */ + || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f)))) count++; } - return count > 1; + return count; } return 1; } --------------020806040703060601000208--