From unknown Sun Jun 22 07:41:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10955: 24.0.94; Closing Speedbar frame raises error Resent-From: Stephen Berman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Mar 2012 11:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10955 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 10955@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13310317435862 (code B ref -1); Tue, 06 Mar 2012 11:03:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Mar 2012 11:02:23 +0000 Received: from localhost ([127.0.0.1]:35373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S4s9u-0001WI-75 for submit@debbugs.gnu.org; Tue, 06 Mar 2012 06:02:23 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47655) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S4s9h-0001Vb-F3 for submit@debbugs.gnu.org; Tue, 06 Mar 2012 06:02:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4s8m-00057A-0T for submit@debbugs.gnu.org; Tue, 06 Mar 2012 06:01:16 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:42606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4s8l-000576-Tg for submit@debbugs.gnu.org; Tue, 06 Mar 2012 06:01:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4s8h-0006zw-3D for bug-gnu-emacs@gnu.org; Tue, 06 Mar 2012 06:01:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4s8a-00056D-8y for bug-gnu-emacs@gnu.org; Tue, 06 Mar 2012 06:01:06 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:51285) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1S4s8Z-00055D-Ur for bug-gnu-emacs@gnu.org; Tue, 06 Mar 2012 06:01:00 -0500 Received: (qmail invoked by alias); 06 Mar 2012 11:00:52 -0000 Received: from i59F55AC6.versanet.de (EHLO escher.home) [89.245.90.198] by mail.gmx.net (mp024) with SMTP; 06 Mar 2012 12:00:52 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1+rLBs5kySrQMwSSEmr/cuMCEUQhw/RhUReQY4qlc c3/spvRMk27pIs From: Stephen Berman Date: Tue, 06 Mar 2012 12:00:51 +0100 Message-ID: <871up6kn8c.fsf@escher.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) 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.) In GNU Emacs 24.0.94.4 (i686-suse-linux-gnu, GTK+ Version 2.24.7) of 2012-03-06 on escher Windowing system distributor `The X.Org Foundation', version 11.0.11004000 Configured using: `configure '--without-toolkit-scroll-bars' 'CFLAGS=-g'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=local locale-coding-system: utf-8-unix default enable-multibyte-characters: t From unknown Sun Jun 22 07:41:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10955: 24.0.94; Closing Speedbar frame raises error 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: To: Stephen Berman Cc: 10955@debbugs.gnu.org Received: via spool by 10955-submit@debbugs.gnu.org id=B10955.13310482341825 (code B ref 10955); Tue, 06 Mar 2012 15:38:01 +0000 Received: (at 10955) by debbugs.gnu.org; 6 Mar 2012 15:37:14 +0000 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 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 Received: (qmail invoked by alias); 06 Mar 2012 15:36:06 -0000 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 Message-ID: <4F562EF1.8060701@gmx.at> Date: Tue, 06 Mar 2012 16:36:17 +0100 From: martin rudalics MIME-Version: 1.0 References: <871up6kn8c.fsf@escher.home> In-Reply-To: <871up6kn8c.fsf@escher.home> Content-Type: multipart/mixed; boundary="------------020806040703060601000208" X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) 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-- From unknown Sun Jun 22 07:41:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10955: 24.0.94; Closing Speedbar frame raises error Resent-From: Stephen Berman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Mar 2012 16:06:02 +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: To: martin rudalics Cc: 10955@debbugs.gnu.org Received: via spool by 10955-submit@debbugs.gnu.org id=B10955.13310499454433 (code B ref 10955); Tue, 06 Mar 2012 16:06:02 +0000 Received: (at 10955) by debbugs.gnu.org; 6 Mar 2012 16:05:45 +0000 Received: from localhost ([127.0.0.1]:36069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S4wtU-00019C-TN for submit@debbugs.gnu.org; Tue, 06 Mar 2012 11:05:45 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:46277) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S4wt9-00018d-U6 for 10955@debbugs.gnu.org; Tue, 06 Mar 2012 11:05:34 -0500 Received: (qmail invoked by alias); 06 Mar 2012 16:04:29 -0000 Received: from i59F55325.versanet.de (EHLO escher.home) [89.245.83.37] by mail.gmx.net (mp039) with SMTP; 06 Mar 2012 17:04:29 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX18koD5BkJAktKqiZqUo8TJmN25+lGi9Z5Lr+8E8UF fhJDhbyA7K0Fyl From: Stephen Berman References: <871up6kn8c.fsf@escher.home> <4F562EF1.8060701@gmx.at> Date: Tue, 06 Mar 2012 17:04:27 +0100 In-Reply-To: <4F562EF1.8060701@gmx.at> (martin rudalics's message of "Tue, 06 Mar 2012 16:36:17 +0100") Message-ID: <87sjhlhg1g.fsf@escher.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On Tue, 06 Mar 2012 16:36:17 +0100 martin rudalics wrote: >> 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) [...] > 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. I also can't say if it's the best fix, but I confirm that with it I don't see the error I reported. Steve Berman From unknown Sun Jun 22 07:41:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10955: 24.0.94; Closing Speedbar frame raises error Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Mar 2012 08:21: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: To: martin rudalics Cc: Stephen Berman , 10955@debbugs.gnu.org Received: via spool by 10955-submit@debbugs.gnu.org id=B10955.133136764314342 (code B ref 10955); Sat, 10 Mar 2012 08:21:01 +0000 Received: (at 10955) by debbugs.gnu.org; 10 Mar 2012 08:20:43 +0000 Received: from localhost ([127.0.0.1]:41818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6HXe-0003jG-1D for submit@debbugs.gnu.org; Sat, 10 Mar 2012 03:20:43 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:46480) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6HXS-0003iy-FI for 10955@debbugs.gnu.org; Sat, 10 Mar 2012 03:20:41 -0500 Received: from bb116-14-103-36.singnet.com.sg ([116.14.103.36]:54978 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1S6H4k-0007l2-KZ; Sat, 10 Mar 2012 02:50:51 -0500 From: Chong Yidong References: <871up6kn8c.fsf@escher.home> <4F562EF1.8060701@gmx.at> Date: Sat, 10 Mar 2012 15:50:42 +0800 In-Reply-To: <4F562EF1.8060701@gmx.at> (martin rudalics's message of "Tue, 06 Mar 2012 16:36:17 +0100") Message-ID: <87d38knbcd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) martin rudalics writes: > 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. Thanks for the analysis, Martin. Judging by the comments in other_visible_frames, the logic was basically out of date in assuming the selected frame can't be invisible. I checked in a slightly more aggressive rewrite that clears this up. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 10 03:20:50 2012 Received: (at control) by debbugs.gnu.org; 10 Mar 2012 08:20:50 +0000 Received: from localhost ([127.0.0.1]:41820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6HXl-0003jX-5V for submit@debbugs.gnu.org; Sat, 10 Mar 2012 03:20:50 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:46482) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6HXa-0003j7-Cl for control@debbugs.gnu.org; Sat, 10 Mar 2012 03:20:48 -0500 Received: from bb116-14-103-36.singnet.com.sg ([116.14.103.36]:54980 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1S6H4t-0007lC-JW for control@debbugs.gnu.org; Sat, 10 Mar 2012 02:51:00 -0500 From: Chong Yidong To: control@debbugs.gnu.org Subject: close 10955 Date: Sat, 10 Mar 2012 15:50:53 +0800 Message-ID: <878vj8j3mq.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) close 10955 thanks