summaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2013-08-15 19:37:03 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2013-08-15 19:37:03 +0400
commit42fe2e88d62c3ff866317f3252f1e78ed0b066a2 (patch)
treebf0c8d16a29b1990a49d7006f819daff0854082b /src/frame.c
parent0542623943803e346aec839369e399e4b0ff43ad (diff)
Fix infinite frame selection loop (Bug#15025).
* frame.c (delete_frame): Prefer fast ad-hoc loop to next_frame.
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/frame.c b/src/frame.c
index bb44f3cc98..957f08b06c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1199,8 +1199,15 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
{
Lisp_Object tail, frame1;
- /* Look for another visible frame on the same terminal. */
- frame1 = next_frame (frame, Qvisible);
+ /* Look for another visible frame on the same terminal.
+ Do not call next_frame here because it may loop forever.
+ See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15025. */
+ FOR_EACH_FRAME (tail, frame1)
+ if (!EQ (frame, frame1)
+ && (FRAME_TERMINAL (XFRAME (frame))
+ == FRAME_TERMINAL (XFRAME (frame1)))
+ && FRAME_VISIBLE_P (XFRAME (frame1)))
+ break;
/* If there is none, find *some* other frame. */
if (NILP (frame1) || EQ (frame1, frame))