emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114615: Attempt to fix crashes per bug #15575.


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r114615: Attempt to fix crashes per bug #15575.
Date: Thu, 10 Oct 2013 19:27:23 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114615
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15575
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2013-10-10 22:26:13 +0300
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/term.c                     term.c-20091113204419-o5vbwnq5f7feedwu-220
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-10 19:15:33 +0000
+++ b/src/ChangeLog     2013-10-10 19:26:13 +0000
@@ -1,3 +1,14 @@
+2013-10-10  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (deep_copy_glyph_row): Assert that the 'used' counts of
+       FROM and TO are identical.  Copy only the glyphs of TEXT_AREA.
+       (Bug#15575)
+
+       * 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.
+
 2013-10-10  Paul Eggert  <address@hidden>
 
        * image.c: Pacify --enable-gcc-warnings.

=== modified file 'src/term.c'
--- a/src/term.c        2013-10-10 06:48:42 +0000
+++ b/src/term.c        2013-10-10 19:26:13 +0000
@@ -3066,22 +3066,6 @@
         screen will not be redrawn anyway.)  */
       to->enabled_p = 1;
       to->hash = from->hash;
-      if (from->used[LEFT_MARGIN_AREA])
-       {
-         nbytes = from->used[LEFT_MARGIN_AREA] * sizeof (struct glyph);
-         to->glyphs[LEFT_MARGIN_AREA] = xmalloc (nbytes);
-         memcpy (to->glyphs[LEFT_MARGIN_AREA],
-                 from->glyphs[LEFT_MARGIN_AREA], nbytes);
-         to->used[LEFT_MARGIN_AREA] = from->used[LEFT_MARGIN_AREA];
-       }
-      if (from->used[RIGHT_MARGIN_AREA])
-       {
-         nbytes = from->used[RIGHT_MARGIN_AREA] * sizeof (struct glyph);
-         to->glyphs[RIGHT_MARGIN_AREA] = xmalloc (nbytes);
-         memcpy (to->glyphs[RIGHT_MARGIN_AREA],
-                 from->glyphs[RIGHT_MARGIN_AREA], nbytes);
-         to->used[RIGHT_MARGIN_AREA] = from->used[RIGHT_MARGIN_AREA];
-       }
     }
 
   return saved;
@@ -3106,26 +3090,6 @@
       to->used[TEXT_AREA] = from->used[TEXT_AREA];
       to->enabled_p = from->enabled_p;
       to->hash = from->hash;
-      nbytes = from->used[LEFT_MARGIN_AREA] * sizeof (struct glyph);
-      if (nbytes)
-       {
-         eassert (to->glyphs[LEFT_MARGIN_AREA] != 
from->glyphs[LEFT_MARGIN_AREA]);
-         memcpy (to->glyphs[LEFT_MARGIN_AREA],
-                 from->glyphs[LEFT_MARGIN_AREA], nbytes);
-         to->used[LEFT_MARGIN_AREA] = from->used[LEFT_MARGIN_AREA];
-       }
-      else
-       to->used[LEFT_MARGIN_AREA] = 0;
-      nbytes = from->used[RIGHT_MARGIN_AREA] * sizeof (struct glyph);
-      if (nbytes)
-       {
-         eassert (to->glyphs[RIGHT_MARGIN_AREA] != 
from->glyphs[RIGHT_MARGIN_AREA]);
-         memcpy (to->glyphs[RIGHT_MARGIN_AREA],
-                 from->glyphs[RIGHT_MARGIN_AREA], nbytes);
-         to->used[RIGHT_MARGIN_AREA] = from->used[RIGHT_MARGIN_AREA];
-       }
-      else
-       to->used[RIGHT_MARGIN_AREA] = 0;
     }
 }
 
@@ -3142,10 +3106,6 @@
       struct glyph_row *from = saved->rows + i;
 
       xfree (from->glyphs[TEXT_AREA]);
-      if (from->used[LEFT_MARGIN_AREA])
-       xfree (from->glyphs[LEFT_MARGIN_AREA]);
-      if (from->used[RIGHT_MARGIN_AREA])
-       xfree (from->glyphs[RIGHT_MARGIN_AREA]);
     }
 
   xfree (saved->rows);

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-10-08 17:49:20 +0000
+++ b/src/xdisp.c       2013-10-10 19:26:13 +0000
@@ -20589,34 +20589,22 @@
 static void
 deep_copy_glyph_row (struct glyph_row *to, struct glyph_row *from)
 {
-  int area, i, sum_used = 0;
+  int area, i;
   struct glyph *pointers[1 + LAST_AREA];
 
   /* Save glyph pointers of TO.  */
   memcpy (pointers, to->glyphs, sizeof to->glyphs);
+  eassert (to->used[TEXT_AREA] == from->used[TEXT_AREA]);
 
   /* Do a structure assignment.  */
   *to = *from;
 
-  /* Restore original pointers of TO.  */
+  /* Restore original glyph pointers of TO.  */
   memcpy (to->glyphs, pointers, sizeof to->glyphs);
 
-  /* Count how many glyphs to copy and update glyph pointers.  */
-  for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
-    {
-      if (area > LEFT_MARGIN_AREA)
-       {
-         eassert (from->glyphs[area] - from->glyphs[area - 1]
-                  == from->used[area - 1]);
-         to->glyphs[area] = to->glyphs[area - 1] + to->used[area - 1];
-       }
-      sum_used += from->used[area];
-    }
-
   /* Copy the glyphs.  */
-  eassert (sum_used <= to->glyphs[LAST_AREA] - to->glyphs[LEFT_MARGIN_AREA]);
-  for (i = 0; i < sum_used; i++)
-    to->glyphs[LEFT_MARGIN_AREA][i] = from->glyphs[LEFT_MARGIN_AREA][i];
+  memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA],
+         from->used[TEXT_AREA] * sizeof (struct glyph));
 }
 
 /* Display one menu item on a TTY, by overwriting the glyphs in the


reply via email to

[Prev in Thread] Current Thread [Next in Thread]