Mercurial > emacs
changeset 83436:f67e432d150c
Fix crash in lookup_image on termcap frames.
* src/xdisp.c (get_glyph_string_clip_rects): Add extra parentheses and
braces to prevent compiler warnings.
(calc_pixel_width_or_height): Add xassert to check that the
frame is alive. Don't call `lookup_image' on a termcap frame.
* image.c (lookup_image): Don't initialize `c' until the xasserts have
been run.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-476
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Fri, 30 Dec 2005 05:29:31 +0000 |
parents | 5efa63b61ac5 |
children | c415fd182aef |
files | src/image.c src/xdisp.c |
diffstat | 2 files changed, 23 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/image.c Fri Dec 30 05:28:31 2005 +0000 +++ b/src/image.c Fri Dec 30 05:29:31 2005 +0000 @@ -1722,7 +1722,7 @@ struct frame *f; Lisp_Object spec; { - struct image_cache *c = FRAME_X_IMAGE_CACHE (f); + struct image_cache *c; struct image *img; int i; unsigned hash; @@ -1734,6 +1734,8 @@ xassert (FRAME_WINDOW_P (f)); xassert (valid_image_p (spec)); + c = FRAME_X_IMAGE_CACHE (f); + GCPRO1 (spec); /* Look up SPEC in the hash table of the image cache. */
--- a/src/xdisp.c Fri Dec 30 05:28:31 2005 +0000 +++ b/src/xdisp.c Fri Dec 30 05:29:31 2005 +0000 @@ -1891,7 +1891,7 @@ } if ((s->for_overlaps & OVERLAPS_BOTH) == 0 - || (s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1) + || ((s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1)) { #ifdef CONVERT_FROM_XRECT CONVERT_FROM_XRECT (r, *rects); @@ -1917,23 +1917,27 @@ { rs[i] = r; if (r.y + r.height > row_y) - if (r.y < row_y) - rs[i].height = row_y - r.y; - else - rs[i].height = 0; + { + if (r.y < row_y) + rs[i].height = row_y - r.y; + else + rs[i].height = 0; + } i++; } if (s->for_overlaps & OVERLAPS_SUCC) { rs[i] = r; if (r.y < row_y + s->row->visible_height) - if (r.y + r.height > row_y + s->row->visible_height) - { - rs[i].y = row_y + s->row->visible_height; - rs[i].height = r.y + r.height - rs[i].y; - } - else - rs[i].height = 0; + { + if (r.y + r.height > row_y + s->row->visible_height) + { + rs[i].y = row_y + s->row->visible_height; + rs[i].height = r.y + r.height - rs[i].y; + } + else + rs[i].height = 0; + } i++; } @@ -18010,6 +18014,8 @@ if (NILP (prop)) return OK_PIXELS (0); + xassert (FRAME_LIVE_P (it->f)); + if (SYMBOLP (prop)) { if (SCHARS (SYMBOL_NAME (prop)) == 2) @@ -18126,7 +18132,8 @@ if (SYMBOLP (car)) { #ifdef HAVE_WINDOW_SYSTEM - if (valid_image_p (prop)) + if (FRAME_WINDOW_P (it->f) + && valid_image_p (prop)) { int id = lookup_image (it->f, prop); struct image *img = IMAGE_FROM_ID (it->f, id);