]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid rare segfaults due to crazy creation of new child frames
authorEli Zaretskii <eliz@gnu.org>
Sat, 22 Mar 2025 19:32:16 +0000 (21:32 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 23 Mar 2025 19:34:01 +0000 (20:34 +0100)
* 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

index 6ad524f05240de47d75986e705903d66f0e0acf7..e7842bfd501a14395c4def4c154b28da26af6175 100644 (file)
@@ -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);
     }
 }