emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 9bf66c6: Don't run FOR_EACH_FRAME when there's no


From: Martin Rudalics
Subject: [Emacs-diffs] emacs-26 9bf66c6: Don't run FOR_EACH_FRAME when there's no frame left (Bug#29961)
Date: Fri, 15 Dec 2017 02:31:20 -0500 (EST)

branch: emacs-26
commit 9bf66c6beec81927e960d31e78b7b3bad060c63e
Author: Martin Rudalics <address@hidden>
Commit: Martin Rudalics <address@hidden>

    Don't run FOR_EACH_FRAME when there's no frame left (Bug#29961)
    
    This does not fix Bug#29961 but avoids that Emacs segfaults when
    trying to shut down because it lost connection to the X server.
    
    * src/dispnew.c (check_glyph_memory):
    * src/frame.c (delete_frame): Don't run FOR_EACH_FRAME when
    there's no frame left (Bug#29961).
---
 src/dispnew.c | 5 +++--
 src/frame.c   | 8 +++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/dispnew.c b/src/dispnew.c
index b0fc5c3..d078647 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -2260,8 +2260,9 @@ check_glyph_memory (void)
   Lisp_Object tail, frame;
 
   /* Free glyph memory for all frames.  */
-  FOR_EACH_FRAME (tail, frame)
-    free_glyphs (XFRAME (frame));
+  if (!NILP (Vframe_list))
+    FOR_EACH_FRAME (tail, frame)
+      free_glyphs (XFRAME (frame));
 
 #if defined GLYPH_DEBUG && defined ENABLE_CHECKING
   /* Check that nothing is left allocated.  */
diff --git a/src/frame.c b/src/frame.c
index 5bafbed..66d1b5c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2058,7 +2058,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
 
   /* If we've deleted the last_nonminibuf_frame, then try to find
      another one.  */
-  if (f == last_nonminibuf_frame)
+  if (f == last_nonminibuf_frame && !NILP (Vframe_list))
     {
       last_nonminibuf_frame = 0;
 
@@ -2076,7 +2076,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
 
   /* If there's no other frame on the same kboard, get out of
      single-kboard state if we're in it for this kboard.  */
-  if (kb != NULL)
+  if (kb != NULL && !NILP (Vframe_list))
     {
       /* Some frame we found on the same kboard, or nil if there are none.  */
       Lisp_Object frame_on_same_kboard = Qnil;
@@ -2093,7 +2093,9 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
   /* If we've deleted this keyboard's default_minibuffer_frame, try to
      find another one.  Prefer minibuffer-only frames, but also notice
      frames with other windows.  */
-  if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame)))
+  if (kb != NULL
+      && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))
+      && !NILP (Vframe_list))
     {
       /* The last frame we saw with a minibuffer, minibuffer-only or not.  */
       Lisp_Object frame_with_minibuf = Qnil;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]