From 3ab3b9a31c587a43d5d8c9572311692d2fd8f10f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 23 Mar 2025 11:30:17 +0200 Subject: [PATCH] Avoid rare segfaults in 'check_matrix_pointers' * src/dispnew.c (check_window_matrix_pointers): No-op if the window's frame not ready yet. (Bug#77200) (cherry picked from commit e20e8538610ed8b78e0b9f9cc3121c1102a8aaf0) --- src/dispnew.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/dispnew.c b/src/dispnew.c index e7842bfd501..7a4b7f394ea 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3110,18 +3110,22 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy static void check_window_matrix_pointers (struct window *w) { - while (w) + struct frame *f = XFRAME (w->frame); + + if (f->after_make_frame) { - if (WINDOWP (w->contents)) - check_window_matrix_pointers (XWINDOW (w->contents)); - else + while (w) { - struct frame *f = XFRAME (w->frame); - check_matrix_pointers (w->desired_matrix, f->desired_matrix); - check_matrix_pointers (w->current_matrix, f->current_matrix); - } + if (WINDOWP (w->contents)) + check_window_matrix_pointers (XWINDOW (w->contents)); + else + { + check_matrix_pointers (w->desired_matrix, f->desired_matrix); + check_matrix_pointers (w->current_matrix, f->current_matrix); + } - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (w->next) ? 0 : XWINDOW (w->next); + } } } -- 2.39.5