diff options
| author | Po Lu | 2024-07-09 22:00:39 +0800 |
|---|---|---|
| committer | Po Lu | 2024-07-09 22:02:22 +0800 |
| commit | 8350ebd22e983df5eb9ad33d427bd3d6a09ffe7f (patch) | |
| tree | b646bd9d4befd3b30fb6e7ad146d8fddb8649925 /src | |
| parent | 8f96e0064fa701655413bdeb4612b5b2a63102c4 (diff) | |
| download | emacs-8350ebd22e983df5eb9ad33d427bd3d6a09ffe7f.tar.gz emacs-8350ebd22e983df5eb9ad33d427bd3d6a09ffe7f.zip | |
Fix bug#71929
* src/image.c (free_image_cache): Unconditionally release image
cache, as this function is only called with its existence
already established.
* src/xfaces.c (free_frame_faces): Clear FRAME_IMAGE_CACHE (f).
(bug#71929)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/image.c | 21 | ||||
| -rw-r--r-- | src/xfaces.c | 5 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index 51dc354d37c..cc248a4472e 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3653,7 +3653,7 @@ extern void x_kill_gs_process (Pixmap, struct frame *); | |||
| 3653 | extern Lisp_Object image_find_image_file (Lisp_Object); | 3653 | extern Lisp_Object image_find_image_file (Lisp_Object); |
| 3654 | 3654 | ||
| 3655 | struct image_cache *make_image_cache (void); | 3655 | struct image_cache *make_image_cache (void); |
| 3656 | void free_image_cache (struct frame *); | 3656 | extern void free_image_cache (struct frame *); |
| 3657 | void clear_image_caches (Lisp_Object); | 3657 | void clear_image_caches (Lisp_Object); |
| 3658 | void mark_image_cache (struct image_cache *); | 3658 | void mark_image_cache (struct image_cache *); |
| 3659 | void image_prune_animation_caches (bool); | 3659 | void image_prune_animation_caches (bool); |
diff --git a/src/image.c b/src/image.c index 2945447b962..2ee2f3245be 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -2304,23 +2304,18 @@ void | |||
| 2304 | free_image_cache (struct frame *f) | 2304 | free_image_cache (struct frame *f) |
| 2305 | { | 2305 | { |
| 2306 | struct image_cache *c = FRAME_IMAGE_CACHE (f); | 2306 | struct image_cache *c = FRAME_IMAGE_CACHE (f); |
| 2307 | if (c) | 2307 | ptrdiff_t i; |
| 2308 | { | ||
| 2309 | ptrdiff_t i; | ||
| 2310 | 2308 | ||
| 2311 | /* Cache should not be referenced by any frame when freed. */ | 2309 | /* Cache should not be referenced by any frame when freed. */ |
| 2312 | eassert (c->refcount == 0); | 2310 | eassert (c->refcount == 0); |
| 2313 | 2311 | ||
| 2314 | for (i = 0; i < c->used; ++i) | 2312 | for (i = 0; i < c->used; ++i) |
| 2315 | free_image (f, c->images[i]); | 2313 | free_image (f, c->images[i]); |
| 2316 | xfree (c->images); | 2314 | xfree (c->images); |
| 2317 | xfree (c->buckets); | 2315 | xfree (c->buckets); |
| 2318 | xfree (c); | 2316 | xfree (c); |
| 2319 | FRAME_IMAGE_CACHE (f) = NULL; | ||
| 2320 | } | ||
| 2321 | } | 2317 | } |
| 2322 | 2318 | ||
| 2323 | |||
| 2324 | /* Clear image cache of frame F. FILTER=t means free all images. | 2319 | /* Clear image cache of frame F. FILTER=t means free all images. |
| 2325 | FILTER=nil means clear only images that haven't been | 2320 | FILTER=nil means clear only images that haven't been |
| 2326 | displayed for some time. | 2321 | displayed for some time. |
diff --git a/src/xfaces.c b/src/xfaces.c index 188dd4778bc..684b6ccfac7 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -712,6 +712,11 @@ free_frame_faces (struct frame *f) | |||
| 712 | --image_cache->refcount; | 712 | --image_cache->refcount; |
| 713 | if (image_cache->refcount == 0) | 713 | if (image_cache->refcount == 0) |
| 714 | free_image_cache (f); | 714 | free_image_cache (f); |
| 715 | |||
| 716 | /* The `image_cache' field must be emptied, in case references | ||
| 717 | to this dead frame should remain and be scanned by GC. | ||
| 718 | (bug#71929) */ | ||
| 719 | FRAME_IMAGE_CACHE (f) = NULL; | ||
| 715 | } | 720 | } |
| 716 | } | 721 | } |
| 717 | #endif /* HAVE_WINDOW_SYSTEM */ | 722 | #endif /* HAVE_WINDOW_SYSTEM */ |