From: martin rudalics <rudalics@gmx.at>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: 10955@debbugs.gnu.org
Subject: bug#10955: 24.0.94; Closing Speedbar frame raises error
Date: Tue, 06 Mar 2012 16:36:17 +0100 [thread overview]
Message-ID: <4F562EF1.8060701@gmx.at> (raw)
In-Reply-To: <871up6kn8c.fsf@escher.home>
[-- Attachment #1: Type: text/plain, Size: 3208 bytes --]
> 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(#<frame Speedbar 1.0 0x89f3f80>)
> window--delete(#<window 8 on SPEEDBAR> t t)
> replace-buffer-in-windows(#<buffer SPEEDBAR>)
> kill-buffer(#<buffer SPEEDBAR>)
> 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
[-- Attachment #2: frame.c.diff --]
[-- Type: text/plain, Size: 755 bytes --]
=== 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;
}
next prev parent reply other threads:[~2012-03-06 15:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 11:00 bug#10955: 24.0.94; Closing Speedbar frame raises error Stephen Berman
2012-03-06 15:36 ` martin rudalics [this message]
2012-03-06 16:04 ` Stephen Berman
2012-03-10 7:50 ` Chong Yidong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F562EF1.8060701@gmx.at \
--to=rudalics@gmx.at \
--cc=10955@debbugs.gnu.org \
--cc=stephen.berman@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).