emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 711e7bf: Fix image-cache-size crash


From: Lars Ingebrigtsen
Subject: master 711e7bf: Fix image-cache-size crash
Date: Fri, 11 Dec 2020 15:16:13 -0500 (EST)

branch: master
commit 711e7bf29cd405a69466feddb5ff9b9a5dfd2a03
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix image-cache-size crash
    
    * src/image.c (image_frame_cache_size): Ensure that img->pixmap is
    in use before trying to access it.
---
 src/image.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/image.c b/src/image.c
index 8607b33..0dd108a 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1795,8 +1795,9 @@ which is then usually a filename.  */)
 static int
 image_frame_cache_size (struct frame *f)
 {
-  struct image_cache *c = FRAME_IMAGE_CACHE (f);
   int total = 0;
+#ifdef USE_CAIRO
+  struct image_cache *c = FRAME_IMAGE_CACHE (f);
 
   if (!c)
     return 0;
@@ -1805,12 +1806,11 @@ image_frame_cache_size (struct frame *f)
     {
       struct image *img = c->images[i];
 
-#ifdef USE_CAIRO
-      if (img)
+      if (img && img->pixmap && img->pixmap != NO_PIXMAP)
        total += img->pixmap->width * img->pixmap->height  *
          img->pixmap->bits_per_pixel / 8;
-#endif
     }
+#endif
   return total;
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]