diff options
| author | Lars Ingebrigtsen | 2020-12-11 21:16:04 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-12-11 21:16:08 +0100 |
| commit | 711e7bf29cd405a69466feddb5ff9b9a5dfd2a03 (patch) | |
| tree | e021802fbdff00ced80c7950ce865831d357f76b /src/image.c | |
| parent | 6864dc1dffee558430c8ef8739585dac10a1ee44 (diff) | |
| download | emacs-711e7bf29cd405a69466feddb5ff9b9a5dfd2a03.tar.gz emacs-711e7bf29cd405a69466feddb5ff9b9a5dfd2a03.zip | |
Fix image-cache-size crash
* src/image.c (image_frame_cache_size): Ensure that img->pixmap is
in use before trying to access it.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/image.c b/src/image.c index 8607b33a7a8..0dd108a96b5 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1795,8 +1795,9 @@ which is then usually a filename. */) | |||
| 1795 | static int | 1795 | static int |
| 1796 | image_frame_cache_size (struct frame *f) | 1796 | image_frame_cache_size (struct frame *f) |
| 1797 | { | 1797 | { |
| 1798 | struct image_cache *c = FRAME_IMAGE_CACHE (f); | ||
| 1799 | int total = 0; | 1798 | int total = 0; |
| 1799 | #ifdef USE_CAIRO | ||
| 1800 | struct image_cache *c = FRAME_IMAGE_CACHE (f); | ||
| 1800 | 1801 | ||
| 1801 | if (!c) | 1802 | if (!c) |
| 1802 | return 0; | 1803 | return 0; |
| @@ -1805,12 +1806,11 @@ image_frame_cache_size (struct frame *f) | |||
| 1805 | { | 1806 | { |
| 1806 | struct image *img = c->images[i]; | 1807 | struct image *img = c->images[i]; |
| 1807 | 1808 | ||
| 1808 | #ifdef USE_CAIRO | 1809 | if (img && img->pixmap && img->pixmap != NO_PIXMAP) |
| 1809 | if (img) | ||
| 1810 | total += img->pixmap->width * img->pixmap->height * | 1810 | total += img->pixmap->width * img->pixmap->height * |
| 1811 | img->pixmap->bits_per_pixel / 8; | 1811 | img->pixmap->bits_per_pixel / 8; |
| 1812 | #endif | ||
| 1813 | } | 1812 | } |
| 1813 | #endif | ||
| 1814 | return total; | 1814 | return total; |
| 1815 | } | 1815 | } |
| 1816 | 1816 | ||