Subject: Re: bug#74274: [PATCH] Revert part of d3f8ed730f to avoid segmentation fault

From: Gerd Möllmann <[email-masked]>
Date: Sat, 09 Nov 2024 08:23:44 +0100

Gerd Möllmann <[email-masked]> writes:

> qijian gong <[email-masked]> writes:
>
>> Gerd Möllmann <[email-masked]>于2024年11月9日 周六下午12:15写道：
>>
>>  Do I understand this right, that the advice you add to
>>  tty-tip-compute-position only serves the purpose of being able to pop up
>>  a tip frame early, when mouse-position doesn't really have a position to
>>  report? Or does it also serve another purpose?
>>
>> Yes, that's correct, there is no other purpose. It seems
>> mouse-position doesn't really have a position until the mouse was
>> moved by user.
>
> Ok, thanks.
>
> I think I know what this is. It's the very particular case of the very
> first redisplay + presence of a child freame, which copies glyphs from a
> current matrix that is still clear, i.e. zeroed, so that glyph::frame
> is zero and so on.

Which is fixed for me with

1 file changed, 6 insertions(+), 3 deletions(-)
src/dispnew.c | 9 ++++++---

modified   src/dispnew.c
@@ -3544,9 +3544,12 @@ prepare_desired_root_row (struct frame *root, int y)
   if (!root_row->enabled_p)
     {
       struct glyph_row *from = MATRIX_ROW (root->current_matrix, y);
-      memcpy (root_row->glyphs[0], from->glyphs[0],
-	      root->current_matrix->matrix_w * sizeof (struct glyph));
-      root_row->enabled_p = true;
+      if (from->enabled_p)
+	{
+	  memcpy (root_row->glyphs[0], from->glyphs[0],
+		  root->current_matrix->matrix_w * sizeof (struct glyph));
+	  root_row->enabled_p = true;
+	}
     }
   return root_row;
 }