comparison 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
comparison
equal deleted inserted replaced
4967:0d4c9d0f6a8d 4968:4d35e52790f8
5469 */ 5469 */
5470 5470
5471 Dynarr_reset (dla); 5471 Dynarr_reset (dla);
5472 w->max_line_len = 0; 5472 w->max_line_len = 0;
5473 5473
5474 /* Added 2-1-10 -- we should never have empty face or glyph cachels
5475 because we initialized them at startup and the only way to reduce
5476 their number is through calling reset_face_cachels() or
5477 reset_glyph_cachels(), which as a side effect sets up a number of
5478 standard entries */
5479 assert (Dynarr_length (w->face_cachels));
5480 assert (Dynarr_length (w->glyph_cachels));
5481
5482 #if 0
5483 /* #### Delete this code sometime later than 2-1-10 when we're sure it's
5484 not needed */
5474 /* Normally these get updated in redisplay_window but it is possible 5485 /* Normally these get updated in redisplay_window but it is possible
5475 for this function to get called from some other points where that 5486 for this function to get called from some other points where that
5476 update may not have occurred. This acts as a safety check. */ 5487 update may not have occurred. This acts as a safety check. */
5477 if (!Dynarr_length (w->face_cachels)) 5488 if (!Dynarr_length (w->face_cachels))
5478 reset_face_cachels (w); 5489 reset_face_cachels (w);
5479 if (!Dynarr_length (w->glyph_cachels)) 5490 if (!Dynarr_length (w->glyph_cachels))
5480 reset_glyph_cachels (w); 5491 reset_glyph_cachels (w);
5492 #endif
5481 5493
5482 Fset_marker (w->start[type], make_int (start_pos), w->buffer); 5494 Fset_marker (w->start[type], make_int (start_pos), w->buffer);
5483 Fset_marker (w->pointm[type], make_int (point), w->buffer); 5495 Fset_marker (w->pointm[type], make_int (point), w->buffer);
5484 w->last_point_x[type] = -1; 5496 w->last_point_x[type] = -1;
5485 w->last_point_y[type] = -1; 5497 w->last_point_y[type] = -1;
6286 pointm = BUF_ZV (b); 6298 pointm = BUF_ZV (b);
6287 } 6299 }
6288 } 6300 }
6289 Fset_marker (w->pointm[DESIRED_DISP], make_int (pointm), the_buffer); 6301 Fset_marker (w->pointm[DESIRED_DISP], make_int (pointm), the_buffer);
6290 6302
6303 /* Added 2-1-10 -- we should never have empty face or glyph cachels
6304 because we initialized them at startup and the only way to reduce
6305 their number is through calling reset_face_cachels() or
6306 reset_glyph_cachels(), which as a side effect sets up a number of
6307 standard entries */
6308 assert (Dynarr_length (w->face_cachels));
6309 assert (Dynarr_length (w->glyph_cachels));
6310
6291 /* If the buffer has changed we have to invalidate all of our face 6311 /* If the buffer has changed we have to invalidate all of our face
6292 cache elements. */ 6312 cache elements. */
6293 if ((!echo_active && b != window_display_buffer (w)) 6313 if ((!echo_active && b != window_display_buffer (w))
6314 #if 0
6315 /* #### Delete this code sometime later than 2-1-10 when we're sure it's
6316 not needed */
6294 || !Dynarr_length (w->face_cachels) 6317 || !Dynarr_length (w->face_cachels)
6318 #endif
6295 || f->faces_changed) 6319 || f->faces_changed)
6296 reset_face_cachels (w); 6320 reset_face_cachels (w);
6297 else 6321 else
6298 mark_face_cachels_as_not_updated (w); 6322 mark_face_cachels_as_not_updated (w);
6299 6323
6300 /* Ditto the glyph cache elements, although we do *not* invalidate 6324 /* Ditto the glyph cache elements, although we do *not* invalidate
6301 the cache purely because glyphs have changed - this is now 6325 the cache purely because glyphs have changed - this is now
6302 handled by the dirty flag.*/ 6326 handled by the dirty flag.*/
6303 if ((!echo_active && b != window_display_buffer (w)) 6327 if ((!echo_active && b != window_display_buffer (w))
6304 || !Dynarr_length (w->glyph_cachels) || f->faces_changed) 6328 #if 0
6329 /* #### Delete this code sometime later than 2-1-10 when we're sure it's
6330 not needed */
6331 || !Dynarr_length (w->glyph_cachels)
6332 #endif
6333 || f->faces_changed)
6305 reset_glyph_cachels (w); 6334 reset_glyph_cachels (w);
6306 else 6335 else
6307 mark_glyph_cachels_as_not_updated (w); 6336 mark_glyph_cachels_as_not_updated (w);
6308 6337
6309 /* If the marker's buffer is not the window's buffer, then we need 6338 /* If the marker's buffer is not the window's buffer, then we need