+2013-08-15 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Fix infinite frame selection loop (Bug#15025).
+ * frame.c (delete_frame): Prefer fast ad-hoc loop to next_frame.
+
2013-08-15 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (compute_window_start_on_continuation_line): When
{
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))