From 87380dae42f2592cb8acb9d588baff75ef115643 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 22 Mar 2025 21:32:16 +0200 Subject: [PATCH] Avoid rare segfaults due to crazy creation of new child frames * src/dispnew.c (combine_updates, combine_updates_for_frame): Skip frames and child frames that were not yet completely made. (Bug#77046) (cherry picked from commit 62368f93a5d2cf1b961626c705c032e15b1d5f43) --- src/dispnew.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dispnew.c b/src/dispnew.c index 6ad524f0524..e7842bfd501 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -4015,6 +4015,9 @@ combine_updates_for_frame (struct frame *f, bool inhibit_scrolling) { struct frame *root = root_frame (f); + if (!root->after_make_frame) + return; + /* Determine visible frames on the root frame, including the root frame itself. Note that there are cases, see bug#75056, where we can be called for invisible frames. This looks like a bug with @@ -4033,7 +4036,8 @@ combine_updates_for_frame (struct frame *f, bool inhibit_scrolling) for (Lisp_Object tail = XCDR (z_order); CONSP (tail); tail = XCDR (tail)) { topmost_child = XFRAME (XCAR (tail)); - copy_child_glyphs (root, topmost_child); + if (topmost_child->after_make_frame) + copy_child_glyphs (root, topmost_child); } update_begin (root); @@ -4086,7 +4090,8 @@ combine_updates (Lisp_Object roots) for (; CONSP (roots); roots = XCDR (roots)) { struct frame *root = XFRAME (XCAR (roots)); - combine_updates_for_frame (root, false); + if (root->after_make_frame) + combine_updates_for_frame (root, false); } } -- 2.39.5