diff options
| author | Gerd Möllmann | 2024-11-05 10:26:36 +0100 |
|---|---|---|
| committer | Gerd Möllmann | 2024-11-05 10:43:24 +0100 |
| commit | 56efab930b5c129aa9c87f99f657b7d704c6d5f9 (patch) | |
| tree | 5fb05b5e26ae07c464590d65e89ed462a1f00523 | |
| parent | 56708ea676e0fdfaeec36607333bb2955ec3b40e (diff) | |
| download | emacs-56efab930b5c129aa9c87f99f657b7d704c6d5f9.tar.gz emacs-56efab930b5c129aa9c87f99f657b7d704c6d5f9.zip | |
TTY menus: handle saved state referencing dead frames
* src/term.c (restore_desired_matrix): If a tty menu saves a current
matrix that contains glyphs from a child frame, handle the case that
that child frame dies before the saved state is restored.
| -rw-r--r-- | src/term.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/term.c b/src/term.c index bd48e1f3e55..a7f7baa6e3c 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -3121,9 +3121,7 @@ save_and_enable_current_matrix (struct frame *f) | |||
| 3121 | static void | 3121 | static void |
| 3122 | restore_desired_matrix (struct frame *f, struct glyph_matrix *saved) | 3122 | restore_desired_matrix (struct frame *f, struct glyph_matrix *saved) |
| 3123 | { | 3123 | { |
| 3124 | int i; | 3124 | for (int i = 0; i < saved->nrows; ++i) |
| 3125 | |||
| 3126 | for (i = 0; i < saved->nrows; ++i) | ||
| 3127 | { | 3125 | { |
| 3128 | struct glyph_row *from = saved->rows + i; | 3126 | struct glyph_row *from = saved->rows + i; |
| 3129 | struct glyph_row *to = f->desired_matrix->rows + i; | 3127 | struct glyph_row *to = f->desired_matrix->rows + i; |
| @@ -3133,7 +3131,23 @@ restore_desired_matrix (struct frame *f, struct glyph_matrix *saved) | |||
| 3133 | memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes); | 3131 | memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes); |
| 3134 | to->used[TEXT_AREA] = from->used[TEXT_AREA]; | 3132 | to->used[TEXT_AREA] = from->used[TEXT_AREA]; |
| 3135 | to->enabled_p = from->enabled_p; | 3133 | to->enabled_p = from->enabled_p; |
| 3136 | to->hash = from->hash; | 3134 | |
| 3135 | bool need_new_hash = false; | ||
| 3136 | for (int x = 0; x < f->desired_matrix->matrix_w; ++x) | ||
| 3137 | { | ||
| 3138 | struct glyph *glyph = to->glyphs[0] + x; | ||
| 3139 | if (!FRAME_LIVE_P (glyph->frame)) | ||
| 3140 | { | ||
| 3141 | glyph->frame = f; | ||
| 3142 | glyph->face_id = DEFAULT_FACE_ID; | ||
| 3143 | need_new_hash = true; | ||
| 3144 | } | ||
| 3145 | } | ||
| 3146 | |||
| 3147 | if (need_new_hash) | ||
| 3148 | to->hash = row_hash (to); | ||
| 3149 | else | ||
| 3150 | to->hash = from->hash; | ||
| 3137 | } | 3151 | } |
| 3138 | } | 3152 | } |
| 3139 | 3153 | ||