diff options
| author | Karoly Lorentey | 2005-12-30 05:29:31 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-12-30 05:29:31 +0000 |
| commit | 4a0e3f08607bbe80ad9dee2c441286f6ad695d0a (patch) | |
| tree | 2a050c8ee5c8df1cb89fe68c69aef5178422cf65 /src | |
| parent | ea161626590293c1128cb327f1111a3c1500fe65 (diff) | |
| download | emacs-4a0e3f08607bbe80ad9dee2c441286f6ad695d0a.tar.gz emacs-4a0e3f08607bbe80ad9dee2c441286f6ad695d0a.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 33 |
2 files changed, 23 insertions, 14 deletions
diff --git a/src/image.c b/src/image.c index 579c04e6f46..0ed50ac6539 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1722,7 +1722,7 @@ lookup_image (f, spec) | |||
| 1722 | struct frame *f; | 1722 | struct frame *f; |
| 1723 | Lisp_Object spec; | 1723 | Lisp_Object spec; |
| 1724 | { | 1724 | { |
| 1725 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 1725 | struct image_cache *c; |
| 1726 | struct image *img; | 1726 | struct image *img; |
| 1727 | int i; | 1727 | int i; |
| 1728 | unsigned hash; | 1728 | unsigned hash; |
| @@ -1734,6 +1734,8 @@ lookup_image (f, spec) | |||
| 1734 | xassert (FRAME_WINDOW_P (f)); | 1734 | xassert (FRAME_WINDOW_P (f)); |
| 1735 | xassert (valid_image_p (spec)); | 1735 | xassert (valid_image_p (spec)); |
| 1736 | 1736 | ||
| 1737 | c = FRAME_X_IMAGE_CACHE (f); | ||
| 1738 | |||
| 1737 | GCPRO1 (spec); | 1739 | GCPRO1 (spec); |
| 1738 | 1740 | ||
| 1739 | /* Look up SPEC in the hash table of the image cache. */ | 1741 | /* Look up SPEC in the hash table of the image cache. */ |
diff --git a/src/xdisp.c b/src/xdisp.c index df6bba2ef0b..6dd0a1f3e69 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1891,7 +1891,7 @@ get_glyph_string_clip_rects (s, rects, n) | |||
| 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); |
| @@ -1917,23 +1917,27 @@ get_glyph_string_clip_rects (s, rects, n) | |||
| 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 | ||
| @@ -18010,6 +18014,8 @@ calc_pixel_width_or_height (res, it, prop, font, width_p, align_to) | |||
| 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) |
| @@ -18126,7 +18132,8 @@ calc_pixel_width_or_height (res, it, prop, font, width_p, align_to) | |||
| 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); |