Mercurial > emacs
comparison src/xdisp.c @ 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 | 76396de7f50a |
children | ff74a86c2b16 |
comparison
equal
deleted
inserted
replaced
83435:5efa63b61ac5 | 83436:f67e432d150c |
---|---|
1889 } | 1889 } |
1890 } | 1890 } |
1891 } | 1891 } |
1892 | 1892 |
1893 if ((s->for_overlaps & OVERLAPS_BOTH) == 0 | 1893 if ((s->for_overlaps & OVERLAPS_BOTH) == 0 |
1894 || (s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1) | 1894 || ((s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1)) |
1895 { | 1895 { |
1896 #ifdef CONVERT_FROM_XRECT | 1896 #ifdef CONVERT_FROM_XRECT |
1897 CONVERT_FROM_XRECT (r, *rects); | 1897 CONVERT_FROM_XRECT (r, *rects); |
1898 #else | 1898 #else |
1899 *rects = r; | 1899 *rects = r; |
1915 | 1915 |
1916 if (s->for_overlaps & OVERLAPS_PRED) | 1916 if (s->for_overlaps & OVERLAPS_PRED) |
1917 { | 1917 { |
1918 rs[i] = r; | 1918 rs[i] = r; |
1919 if (r.y + r.height > row_y) | 1919 if (r.y + r.height > row_y) |
1920 if (r.y < row_y) | 1920 { |
1921 rs[i].height = row_y - r.y; | 1921 if (r.y < row_y) |
1922 else | 1922 rs[i].height = row_y - r.y; |
1923 rs[i].height = 0; | 1923 else |
1924 rs[i].height = 0; | |
1925 } | |
1924 i++; | 1926 i++; |
1925 } | 1927 } |
1926 if (s->for_overlaps & OVERLAPS_SUCC) | 1928 if (s->for_overlaps & OVERLAPS_SUCC) |
1927 { | 1929 { |
1928 rs[i] = r; | 1930 rs[i] = r; |
1929 if (r.y < row_y + s->row->visible_height) | 1931 if (r.y < row_y + s->row->visible_height) |
1930 if (r.y + r.height > row_y + s->row->visible_height) | 1932 { |
1931 { | 1933 if (r.y + r.height > row_y + s->row->visible_height) |
1932 rs[i].y = row_y + s->row->visible_height; | 1934 { |
1933 rs[i].height = r.y + r.height - rs[i].y; | 1935 rs[i].y = row_y + s->row->visible_height; |
1934 } | 1936 rs[i].height = r.y + r.height - rs[i].y; |
1935 else | 1937 } |
1936 rs[i].height = 0; | 1938 else |
1939 rs[i].height = 0; | |
1940 } | |
1937 i++; | 1941 i++; |
1938 } | 1942 } |
1939 | 1943 |
1940 n = i; | 1944 n = i; |
1941 #ifdef CONVERT_FROM_XRECT | 1945 #ifdef CONVERT_FROM_XRECT |
18008 #define OK_ALIGN_TO(val) ((*align_to = (int)(val)), 1) | 18012 #define OK_ALIGN_TO(val) ((*align_to = (int)(val)), 1) |
18009 | 18013 |
18010 if (NILP (prop)) | 18014 if (NILP (prop)) |
18011 return OK_PIXELS (0); | 18015 return OK_PIXELS (0); |
18012 | 18016 |
18017 xassert (FRAME_LIVE_P (it->f)); | |
18018 | |
18013 if (SYMBOLP (prop)) | 18019 if (SYMBOLP (prop)) |
18014 { | 18020 { |
18015 if (SCHARS (SYMBOL_NAME (prop)) == 2) | 18021 if (SCHARS (SYMBOL_NAME (prop)) == 2) |
18016 { | 18022 { |
18017 char *unit = SDATA (SYMBOL_NAME (prop)); | 18023 char *unit = SDATA (SYMBOL_NAME (prop)); |
18124 Lisp_Object cdr = XCDR (prop); | 18130 Lisp_Object cdr = XCDR (prop); |
18125 | 18131 |
18126 if (SYMBOLP (car)) | 18132 if (SYMBOLP (car)) |
18127 { | 18133 { |
18128 #ifdef HAVE_WINDOW_SYSTEM | 18134 #ifdef HAVE_WINDOW_SYSTEM |
18129 if (valid_image_p (prop)) | 18135 if (FRAME_WINDOW_P (it->f) |
18136 && valid_image_p (prop)) | |
18130 { | 18137 { |
18131 int id = lookup_image (it->f, prop); | 18138 int id = lookup_image (it->f, prop); |
18132 struct image *img = IMAGE_FROM_ID (it->f, id); | 18139 struct image *img = IMAGE_FROM_ID (it->f, id); |
18133 | 18140 |
18134 return OK_PIXELS (width_p ? img->width : img->height); | 18141 return OK_PIXELS (width_p ? img->width : img->height); |