extern Lisp_Object image_find_image_file (Lisp_Object);
struct image_cache *make_image_cache (void);
-void free_image_cache (struct frame *);
+extern void free_image_cache (struct frame *);
void clear_image_caches (Lisp_Object);
void mark_image_cache (struct image_cache *);
void image_prune_animation_caches (bool);
free_image_cache (struct frame *f)
{
struct image_cache *c = FRAME_IMAGE_CACHE (f);
- if (c)
- {
- ptrdiff_t i;
+ ptrdiff_t i;
- /* Cache should not be referenced by any frame when freed. */
- eassert (c->refcount == 0);
+ /* Cache should not be referenced by any frame when freed. */
+ eassert (c->refcount == 0);
- for (i = 0; i < c->used; ++i)
- free_image (f, c->images[i]);
- xfree (c->images);
- xfree (c->buckets);
- xfree (c);
- FRAME_IMAGE_CACHE (f) = NULL;
- }
+ for (i = 0; i < c->used; ++i)
+ free_image (f, c->images[i]);
+ xfree (c->images);
+ xfree (c->buckets);
+ xfree (c);
}
-
/* Clear image cache of frame F. FILTER=t means free all images.
FILTER=nil means clear only images that haven't been
displayed for some time.
--image_cache->refcount;
if (image_cache->refcount == 0)
free_image_cache (f);
+
+ /* The `image_cache' field must be emptied, in case references
+ to this dead frame should remain and be scanned by GC.
+ (bug#71929) */
+ FRAME_IMAGE_CACHE (f) = NULL;
}
}
#endif /* HAVE_WINDOW_SYSTEM */