aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorEli Zaretskii2013-10-10 22:26:13 +0300
committerEli Zaretskii2013-10-10 22:26:13 +0300
commit00036e1dd2f2194fbc7938076defbe2d7228c8a3 (patch)
tree1d85d9dcfcb15ebf87dc8a5958d7ca63e28b6669 /src/term.c
parent991496253a519d728a1041c157b37182a829d156 (diff)
downloademacs-00036e1dd2f2194fbc7938076defbe2d7228c8a3.tar.gz
emacs-00036e1dd2f2194fbc7938076defbe2d7228c8a3.zip
Attempt to fix crashes per bug #15575.
src/xdisp.c (deep_copy_glyph_row): Assert that the 'used' counts of FROM and TO are identical. Copy only the glyphs of TEXT_AREA. src/term.c (save_and_enable_current_matrix): Don't allocate and don't save margin areas. (restore_desired_matrix): Don't restore margin areas. (free_saved_screen): Don't free margin areas.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/term.c b/src/term.c
index a8274b19d2a..a4f8f2ea17c 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3066,22 +3066,6 @@ save_and_enable_current_matrix (struct frame *f)
3066 screen will not be redrawn anyway.) */ 3066 screen will not be redrawn anyway.) */
3067 to->enabled_p = 1; 3067 to->enabled_p = 1;
3068 to->hash = from->hash; 3068 to->hash = from->hash;
3069 if (from->used[LEFT_MARGIN_AREA])
3070 {
3071 nbytes = from->used[LEFT_MARGIN_AREA] * sizeof (struct glyph);
3072 to->glyphs[LEFT_MARGIN_AREA] = xmalloc (nbytes);
3073 memcpy (to->glyphs[LEFT_MARGIN_AREA],
3074 from->glyphs[LEFT_MARGIN_AREA], nbytes);
3075 to->used[LEFT_MARGIN_AREA] = from->used[LEFT_MARGIN_AREA];
3076 }
3077 if (from->used[RIGHT_MARGIN_AREA])
3078 {
3079 nbytes = from->used[RIGHT_MARGIN_AREA] * sizeof (struct glyph);
3080 to->glyphs[RIGHT_MARGIN_AREA] = xmalloc (nbytes);
3081 memcpy (to->glyphs[RIGHT_MARGIN_AREA],
3082 from->glyphs[RIGHT_MARGIN_AREA], nbytes);
3083 to->used[RIGHT_MARGIN_AREA] = from->used[RIGHT_MARGIN_AREA];
3084 }
3085 } 3069 }
3086 3070
3087 return saved; 3071 return saved;
@@ -3106,26 +3090,6 @@ restore_desired_matrix (struct frame *f, struct glyph_matrix *saved)
3106 to->used[TEXT_AREA] = from->used[TEXT_AREA]; 3090 to->used[TEXT_AREA] = from->used[TEXT_AREA];
3107 to->enabled_p = from->enabled_p; 3091 to->enabled_p = from->enabled_p;
3108 to->hash = from->hash; 3092 to->hash = from->hash;
3109 nbytes = from->used[LEFT_MARGIN_AREA] * sizeof (struct glyph);
3110 if (nbytes)
3111 {
3112 eassert (to->glyphs[LEFT_MARGIN_AREA] != from->glyphs[LEFT_MARGIN_AREA]);
3113 memcpy (to->glyphs[LEFT_MARGIN_AREA],
3114 from->glyphs[LEFT_MARGIN_AREA], nbytes);
3115 to->used[LEFT_MARGIN_AREA] = from->used[LEFT_MARGIN_AREA];
3116 }
3117 else
3118 to->used[LEFT_MARGIN_AREA] = 0;
3119 nbytes = from->used[RIGHT_MARGIN_AREA] * sizeof (struct glyph);
3120 if (nbytes)
3121 {
3122 eassert (to->glyphs[RIGHT_MARGIN_AREA] != from->glyphs[RIGHT_MARGIN_AREA]);
3123 memcpy (to->glyphs[RIGHT_MARGIN_AREA],
3124 from->glyphs[RIGHT_MARGIN_AREA], nbytes);
3125 to->used[RIGHT_MARGIN_AREA] = from->used[RIGHT_MARGIN_AREA];
3126 }
3127 else
3128 to->used[RIGHT_MARGIN_AREA] = 0;
3129 } 3093 }
3130} 3094}
3131 3095
@@ -3142,10 +3106,6 @@ free_saved_screen (struct glyph_matrix *saved)
3142 struct glyph_row *from = saved->rows + i; 3106 struct glyph_row *from = saved->rows + i;
3143 3107
3144 xfree (from->glyphs[TEXT_AREA]); 3108 xfree (from->glyphs[TEXT_AREA]);
3145 if (from->used[LEFT_MARGIN_AREA])
3146 xfree (from->glyphs[LEFT_MARGIN_AREA]);
3147 if (from->used[RIGHT_MARGIN_AREA])
3148 xfree (from->glyphs[RIGHT_MARGIN_AREA]);
3149 } 3109 }
3150 3110
3151 xfree (saved->rows); 3111 xfree (saved->rows);