diff src/redisplay.c @ 4968:4d35e52790f8

fix crash in glyph-cachels -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-03 Ben Wing <ben@xemacs.org> * frame.c (Fmake_frame): * glyphs.c: * glyphs.c (NUM_PRECACHED_GLYPHS): * glyphs.c (get_glyph_cachel_index): * glyphs.c (FROB): * glyphs.c (mark_glyph_cachels_as_not_updated): * redisplay.c (regenerate_window): * redisplay.c (redisplay_window): When creating a frame, call reset_glyph_cachels on the minibuffer window as well as the root window. Fixes a crash due to other glyphs (e.g. the gutter glyph) getting in the glyph cachel before the pre-cached glyphs that are supposed to have fixed indices (continuation-glyph, truncation-glyph, etc.). Add a bunch of asserts to make sure that the glyph cachels always properly contain the pre-cached glyphs.
author Ben Wing <ben@xemacs.org>
date Wed, 03 Feb 2010 21:06:14 -0600
parents 0d4c9d0f6a8d
children 5c89ceb69819
line wrap: on
line diff
--- a/src/redisplay.c	Wed Feb 03 20:51:18 2010 -0600
+++ b/src/redisplay.c	Wed Feb 03 21:06:14 2010 -0600
@@ -5471,6 +5471,17 @@
   Dynarr_reset (dla);
   w->max_line_len = 0;
 
+  /* Added 2-1-10 -- we should never have empty face or glyph cachels
+     because we initialized them at startup and the only way to reduce
+     their number is through calling reset_face_cachels() or
+     reset_glyph_cachels(), which as a side effect sets up a number of
+     standard entries */
+  assert (Dynarr_length (w->face_cachels));
+  assert (Dynarr_length (w->glyph_cachels));
+
+#if 0
+  /* #### Delete this code sometime later than 2-1-10 when we're sure it's
+     not needed */
   /* Normally these get updated in redisplay_window but it is possible
      for this function to get called from some other points where that
      update may not have occurred.  This acts as a safety check. */
@@ -5478,6 +5489,7 @@
     reset_face_cachels (w);
   if (!Dynarr_length (w->glyph_cachels))
     reset_glyph_cachels (w);
+#endif
 
   Fset_marker (w->start[type], make_int (start_pos), w->buffer);
   Fset_marker (w->pointm[type], make_int (point), w->buffer);
@@ -6288,10 +6300,22 @@
     }
   Fset_marker (w->pointm[DESIRED_DISP], make_int (pointm), the_buffer);
 
+  /* Added 2-1-10 -- we should never have empty face or glyph cachels
+     because we initialized them at startup and the only way to reduce
+     their number is through calling reset_face_cachels() or
+     reset_glyph_cachels(), which as a side effect sets up a number of
+     standard entries */
+  assert (Dynarr_length (w->face_cachels));
+  assert (Dynarr_length (w->glyph_cachels));
+
   /* If the buffer has changed we have to invalidate all of our face
      cache elements. */
   if ((!echo_active && b != window_display_buffer (w))
+#if 0
+  /* #### Delete this code sometime later than 2-1-10 when we're sure it's
+     not needed */
       || !Dynarr_length (w->face_cachels)
+#endif
       || f->faces_changed)
     reset_face_cachels (w);
   else
@@ -6301,7 +6325,12 @@
      the cache purely because glyphs have changed - this is now
      handled by the dirty flag.*/
   if ((!echo_active && b != window_display_buffer (w))
-      || !Dynarr_length (w->glyph_cachels) || f->faces_changed)
+#if 0
+  /* #### Delete this code sometime later than 2-1-10 when we're sure it's
+     not needed */
+      || !Dynarr_length (w->glyph_cachels)
+#endif
+      || f->faces_changed)
     reset_glyph_cachels (w);
   else
     mark_glyph_cachels_as_not_updated (w);