aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Rudalics2017-12-15 08:30:09 +0100
committerMartin Rudalics2017-12-15 08:30:09 +0100
commit9bf66c6beec81927e960d31e78b7b3bad060c63e (patch)
treee7d32b780d973fb3ea84e7d86aa6fa2a9ee63036 /src
parentc2a88ec8e8f3246c0f5051b208337205f7f96cca (diff)
downloademacs-9bf66c6beec81927e960d31e78b7b3bad060c63e.tar.gz
emacs-9bf66c6beec81927e960d31e78b7b3bad060c63e.zip
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).
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c5
-rw-r--r--src/frame.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index b0fc5c31fa1..d07864718c3 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -2260,8 +2260,9 @@ check_glyph_memory (void)
2260 Lisp_Object tail, frame; 2260 Lisp_Object tail, frame;
2261 2261
2262 /* Free glyph memory for all frames. */ 2262 /* Free glyph memory for all frames. */
2263 FOR_EACH_FRAME (tail, frame) 2263 if (!NILP (Vframe_list))
2264 free_glyphs (XFRAME (frame)); 2264 FOR_EACH_FRAME (tail, frame)
2265 free_glyphs (XFRAME (frame));
2265 2266
2266#if defined GLYPH_DEBUG && defined ENABLE_CHECKING 2267#if defined GLYPH_DEBUG && defined ENABLE_CHECKING
2267 /* Check that nothing is left allocated. */ 2268 /* Check that nothing is left allocated. */
diff --git a/src/frame.c b/src/frame.c
index 5bafbeddcce..66d1b5c759e 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2058,7 +2058,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
2058 2058
2059 /* If we've deleted the last_nonminibuf_frame, then try to find 2059 /* If we've deleted the last_nonminibuf_frame, then try to find
2060 another one. */ 2060 another one. */
2061 if (f == last_nonminibuf_frame) 2061 if (f == last_nonminibuf_frame && !NILP (Vframe_list))
2062 { 2062 {
2063 last_nonminibuf_frame = 0; 2063 last_nonminibuf_frame = 0;
2064 2064
@@ -2076,7 +2076,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
2076 2076
2077 /* If there's no other frame on the same kboard, get out of 2077 /* If there's no other frame on the same kboard, get out of
2078 single-kboard state if we're in it for this kboard. */ 2078 single-kboard state if we're in it for this kboard. */
2079 if (kb != NULL) 2079 if (kb != NULL && !NILP (Vframe_list))
2080 { 2080 {
2081 /* Some frame we found on the same kboard, or nil if there are none. */ 2081 /* Some frame we found on the same kboard, or nil if there are none. */
2082 Lisp_Object frame_on_same_kboard = Qnil; 2082 Lisp_Object frame_on_same_kboard = Qnil;
@@ -2093,7 +2093,9 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
2093 /* If we've deleted this keyboard's default_minibuffer_frame, try to 2093 /* If we've deleted this keyboard's default_minibuffer_frame, try to
2094 find another one. Prefer minibuffer-only frames, but also notice 2094 find another one. Prefer minibuffer-only frames, but also notice
2095 frames with other windows. */ 2095 frames with other windows. */
2096 if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))) 2096 if (kb != NULL
2097 && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))
2098 && !NILP (Vframe_list))
2097 { 2099 {
2098 /* The last frame we saw with a minibuffer, minibuffer-only or not. */ 2100 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
2099 Lisp_Object frame_with_minibuf = Qnil; 2101 Lisp_Object frame_with_minibuf = Qnil;