diff --git a/src/ChangeLog b/src/ChangeLog index 77c37864b00..888db1f8cf4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-08-15 Dmitry Antipov + + Fix infinite frame selection loop (Bug#15025). + * frame.c (delete_frame): Prefer fast ad-hoc loop to next_frame. + 2013-08-15 Eli Zaretskii * xdisp.c (compute_window_start_on_continuation_line): When diff --git a/src/frame.c b/src/frame.c index bb44f3cc987..957f08b06c5 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))