Fix bug#72255
authorPo Lu <luangruo@yahoo.com>
Wed, 24 Jul 2024 03:38:54 +0000 (11:38 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 24 Jul 2024 03:39:07 +0000 (11:39 +0800)
* src/image.c (struct image_type): Minor grammatical
corrections.
(image_destroy_x_image): [HAVE_NS]: Do not release
Emacs_Pix_Containers, which are identical to Emacs_Pixmaps and
consequently always released with the `struct image'.
(bug#72255)

src/image.c

index 3d761bd48bedf59b79c59b28600ec7a60ea0420c..5aabb517f30b73e5bca71d71e05f0c1206b02264 100644 (file)
@@ -1328,11 +1328,11 @@ struct image_type
      image type.  Value is true if SPEC is valid.  */
   bool (*valid_p) (Lisp_Object spec);
 
-  /* Load IMG which is used on frame F from information contained in
-     IMG->spec.  Value is true if successful.  */
+  /* Load IMG which is to be used on frame F from information contained
+     in IMG->spec.  Value is true if successful.  */
   bool (*load_img) (struct frame *f, struct image *img);
 
-  /* Free resources of image IMG which is used on frame F.  */
+  /* Free such resources of image IMG as are used on frame F.  */
   void (*free_img) (struct frame *f, struct image *img);
 
 #ifdef WINDOWSNT
@@ -4153,16 +4153,16 @@ image_destroy_x_image (Emacs_Pix_Container pimg)
   eassert (input_blocked_p ());
   if (pimg)
     {
-#ifdef USE_CAIRO
-#endif /* USE_CAIRO */
+#if defined USE_CAIRO || defined HAVE_HAIKU || defined HAVE_NS
+      /* On these systems, Emacs_Pix_Containers always point to the same
+        data as pixmaps in `struct image', and therefore must never be
+        freed separately.  */
+#endif /* USE_CAIRO || HAVE_HAIKU || HAVE_NS */
 #ifdef HAVE_NTGUI
       /* Data will be freed by DestroyObject.  */
       pimg->data = NULL;
       xfree (pimg);
 #endif /* HAVE_NTGUI */
-#ifdef HAVE_NS
-      ns_release_object (pimg);
-#endif /* HAVE_NS */
     }
 #endif
 }