all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Drew Adams <drew.adams@oracle.com>
Cc: Juanma Barranquero <lekktu@gmail.com>, 15183@debbugs.gnu.org
Subject: bug#15183: 24.3.50; emacs_backtrace.txt
Date: Sun, 25 Aug 2013 19:31:20 +0200	[thread overview]
Message-ID: <521A3F68.50700@gmx.at> (raw)
In-Reply-To: <79502512-9512-430e-8358-b9e04cdd3f9b@default>

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

 > In case it helps, let me repeat what I wrote at the outset for this bug:
 > this crash came from a session started with `emacs -Q', *not* from my
 > setup (so no standalone minibuffer etc.).

IIUC at least one frame didn't have a minibuffer since otherwise this
error could not have occured.  FWIW the attached patch should fix it but
I don't have any idea how to test it.

martin

[-- Attachment #2: frame.c.diff --]
[-- Type: text/plain, Size: 3630 bytes --]

=== modified file 'src/frame.c'
--- src/frame.c	2013-08-15 16:28:42 +0000
+++ src/frame.c	2013-08-25 17:22:14 +0000
@@ -1110,6 +1110,44 @@
   return 0;
 }
 
+/* Set minibuf_window preferably to the selected frame's minibuffer
+   window.  If the selected frame doesn't have one, get some other
+   frame's minibuffer window.  not-this is a frame that must be
+   skipped.  select non-zero means select the new window.  */
+Lisp_Object
+set_minibuf_window (Lisp_Object not_this, int select)
+{
+  Lisp_Object frames, this, window;
+
+  if (FRAME_HAS_MINIBUF_P (XFRAME (selected_frame)))
+    window = FRAME_MINIBUF_WINDOW (XFRAME (selected_frame));
+  else
+    FOR_EACH_FRAME (frames, this)
+      {
+	if (!EQ (this, not_this) && FRAME_HAS_MINIBUF_P (XFRAME (this)))
+	  {
+	    window = FRAME_MINIBUF_WINDOW (XFRAME (this));
+	    break;
+	  }
+      }
+
+  if (!WINDOWP (window))
+    emacs_abort ();
+  else
+    {
+      /* Use set_window_buffer instead of Fset_window_buffer (see
+	 discussion of bug#11984, bug#12025, bug#12026).  */
+      set_window_buffer (window, XWINDOW (minibuf_window)->contents, 0, 0);
+      minibuf_window = window;
+
+      /* If the previous minibuffer window was selected, select the new
+	 one.  */
+      if (select)
+	Fselect_window (minibuf_window, Qnil);
+    }
+}
+
+
 /* Delete FRAME.  When FORCE equals Qnoelisp, delete FRAME
   unconditionally.  x_connection_closed and delete_terminal use
   this.  Any other value of FORCE implements the semantics
@@ -1245,18 +1283,7 @@
 
   /* Don't allow minibuf_window to remain on a deleted frame.  */
   if (EQ (f->minibuffer_window, minibuf_window))
-    {
-      /* Use set_window_buffer instead of Fset_window_buffer (see
-	 discussion of bug#11984, bug#12025, bug#12026).  */
-      set_window_buffer (sf->minibuffer_window,
-			 XWINDOW (minibuf_window)->contents, 0, 0);
-      minibuf_window = sf->minibuffer_window;
-
-      /* If the dying minibuffer window was selected,
-	 select the new one.  */
-      if (minibuffer_selected)
-	Fselect_window (minibuf_window, Qnil);
-    }
+    set_minibuf_window (frame, minibuffer_selected);
 
   /* Don't let echo_area_window to remain on a deleted frame.  */
   if (EQ (f->minibuffer_window, echo_area_window))
@@ -1683,16 +1710,9 @@
   if (NILP (force) && !other_visible_frames (f))
     error ("Attempt to make invisible the sole visible or iconified frame");
 
-  /* Don't allow minibuf_window to remain on a deleted frame.  */
+  /* Don't allow minibuf_window to remain on an invisible frame.  */
   if (EQ (f->minibuffer_window, minibuf_window))
-    {
-      struct frame *sf = XFRAME (selected_frame);
-      /* Use set_window_buffer instead of Fset_window_buffer (see
-	 discussion of bug#11984, bug#12025, bug#12026).  */
-      set_window_buffer (sf->minibuffer_window,
-			 XWINDOW (minibuf_window)->contents, 0, 0);
-      minibuf_window = sf->minibuffer_window;
-    }
+    set_minibuf_window (frame, 0);
 
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1716,14 +1736,7 @@
 
   /* Don't allow minibuf_window to remain on an iconified frame.  */
   if (EQ (f->minibuffer_window, minibuf_window))
-    {
-      struct frame *sf = XFRAME (selected_frame);
-      /* Use set_window_buffer instead of Fset_window_buffer (see
-	 discussion of bug#11984, bug#12025, bug#12026).  */
-      set_window_buffer (sf->minibuffer_window,
-			 XWINDOW (minibuf_window)->contents, 0, 0);
-      minibuf_window = sf->minibuffer_window;
-    }
+    set_minibuf_window (frame, 0);
 
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM



  reply	other threads:[~2013-08-25 17:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-25  1:01 bug#15183: 24.3.50; emacs_backtrace.txt Drew Adams
2013-08-25  1:51 ` Juanma Barranquero
2013-08-25 14:36   ` martin rudalics
2013-08-25 16:28     ` Drew Adams
2013-08-25 17:31       ` martin rudalics [this message]
2013-08-25 17:49         ` Eli Zaretskii
2013-08-26 13:06           ` martin rudalics
2013-08-26 13:34             ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=521A3F68.50700@gmx.at \
    --to=rudalics@gmx.at \
    --cc=15183@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=lekktu@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.