aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBasil L. Contovounesios2026-01-27 15:13:15 +0100
committerBasil L. Contovounesios2026-01-28 10:29:46 +0100
commitf9080e9bc08367b2bdc8779975dd7d7945f36859 (patch)
treeaf57de14c2f21d883d4ba3e64b16de7038a4784c /src
parent89dad017639265c313fd0e90f02e00c2a1cfea84 (diff)
downloademacs-f9080e9bc08367b2bdc8779975dd7d7945f36859.tar.gz
emacs-f9080e9bc08367b2bdc8779975dd7d7945f36859.zip
Always unset lisp_data when freeing images
Historically only the GIF code did this (since it stores animation metadata in lisp_data), and recently the WebP code followed suit. The benefit of clearing lisp_data is not 100% clear (to me: bug#66221#41), but it probably can't hurt, so do it unconditionally for all image types to simplify conditional compilation and avoid warnings (bug#80266). * src/image.c (image_clear_image): Set lisp_data to nil. [HAVE_GIF || HAVE_WEBP] (gif_clear_image): [HAVE_IMAGEMAGICK] (imagemagick_clear_image): Remove, replacing all uses with image_clear_image.
Diffstat (limited to 'src')
-rw-r--r--src/image.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/src/image.c b/src/image.c
index 5a4bc3024c3..ccbf5db028f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2131,6 +2131,7 @@ image_clear_image_1 (struct frame *f, struct image *img, int flags)
2131static void 2131static void
2132image_clear_image (struct frame *f, struct image *img) 2132image_clear_image (struct frame *f, struct image *img)
2133{ 2133{
2134 img->lisp_data = Qnil;
2134 block_input (); 2135 block_input ();
2135 image_clear_image_1 (f, img, 2136 image_clear_image_1 (f, img,
2136 (CLEAR_IMAGE_PIXMAP 2137 (CLEAR_IMAGE_PIXMAP
@@ -9653,24 +9654,6 @@ static const struct image_keyword gif_format[GIF_LAST] =
9653 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} 9654 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
9654}; 9655};
9655 9656
9656#endif
9657
9658#if defined HAVE_GIF || defined HAVE_WEBP
9659
9660/* Free X resources of GIF image IMG which is used on frame F.
9661 Also used by other image types. */
9662
9663static void
9664gif_clear_image (struct frame *f, struct image *img)
9665{
9666 img->lisp_data = Qnil;
9667 image_clear_image (f, img);
9668}
9669
9670#endif /* defined HAVE_GIF || defined HAVE_WEBP */
9671
9672#if defined (HAVE_GIF)
9673
9674/* Return true if OBJECT is a valid GIF image specification. */ 9657/* Return true if OBJECT is a valid GIF image specification. */
9675 9658
9676static bool 9659static bool
@@ -10900,15 +10883,6 @@ static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] =
10900 {":crop", IMAGE_DONT_CHECK_VALUE_TYPE, 0} 10883 {":crop", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
10901 }; 10884 };
10902 10885
10903/* Free X resources of imagemagick image IMG which is used on frame F. */
10904
10905static void
10906imagemagick_clear_image (struct frame *f,
10907 struct image *img)
10908{
10909 image_clear_image (f, img);
10910}
10911
10912/* Return true if OBJECT is a valid IMAGEMAGICK image specification. Do 10886/* Return true if OBJECT is a valid IMAGEMAGICK image specification. Do
10913 this by calling parse_image_spec and supplying the keywords that 10887 this by calling parse_image_spec and supplying the keywords that
10914 identify the IMAGEMAGICK format. */ 10888 identify the IMAGEMAGICK format. */
@@ -12954,7 +12928,7 @@ static struct image_type const image_types[] =
12954#endif 12928#endif
12955#ifdef HAVE_IMAGEMAGICK 12929#ifdef HAVE_IMAGEMAGICK
12956 { SYMBOL_INDEX (Qimagemagick), imagemagick_image_p, imagemagick_load, 12930 { SYMBOL_INDEX (Qimagemagick), imagemagick_image_p, imagemagick_load,
12957 imagemagick_clear_image }, 12931 image_clear_image },
12958#endif 12932#endif
12959#ifdef HAVE_RSVG 12933#ifdef HAVE_RSVG
12960 { SYMBOL_INDEX (Qsvg), svg_image_p, svg_load, image_clear_image, 12934 { SYMBOL_INDEX (Qsvg), svg_image_p, svg_load, image_clear_image,
@@ -12965,7 +12939,7 @@ static struct image_type const image_types[] =
12965 IMAGE_TYPE_INIT (init_png_functions) }, 12939 IMAGE_TYPE_INIT (init_png_functions) },
12966#endif 12940#endif
12967#if defined HAVE_GIF 12941#if defined HAVE_GIF
12968 { SYMBOL_INDEX (Qgif), gif_image_p, gif_load, gif_clear_image, 12942 { SYMBOL_INDEX (Qgif), gif_image_p, gif_load, image_clear_image,
12969 IMAGE_TYPE_INIT (init_gif_functions) }, 12943 IMAGE_TYPE_INIT (init_gif_functions) },
12970#endif 12944#endif
12971#if defined HAVE_TIFF 12945#if defined HAVE_TIFF
@@ -12982,7 +12956,7 @@ static struct image_type const image_types[] =
12982 IMAGE_TYPE_INIT (init_xpm_functions) }, 12956 IMAGE_TYPE_INIT (init_xpm_functions) },
12983#endif 12957#endif
12984#if defined HAVE_WEBP 12958#if defined HAVE_WEBP
12985 { SYMBOL_INDEX (Qwebp), webp_image_p, webp_load, gif_clear_image, 12959 { SYMBOL_INDEX (Qwebp), webp_image_p, webp_load, image_clear_image,
12986 IMAGE_TYPE_INIT (init_webp_functions) }, 12960 IMAGE_TYPE_INIT (init_webp_functions) },
12987#endif 12961#endif
12988 { SYMBOL_INDEX (Qxbm), xbm_image_p, xbm_load, image_clear_image }, 12962 { SYMBOL_INDEX (Qxbm), xbm_image_p, xbm_load, image_clear_image },