mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 22:26:18 +00:00
Track which list (images or saved_images) each image is on so they can be
removed from the correct list when the total image count is reached. Fixes crash reported by xlabai at tencent dot com.
This commit is contained in:
7
image.c
7
image.c
@@ -53,14 +53,12 @@ image_log(struct image *im, const char* from, const char* fmt, ...)
|
||||
static void
|
||||
image_free(struct image *im)
|
||||
{
|
||||
struct screen *s = im->s;
|
||||
|
||||
image_log(im, __func__, NULL);
|
||||
|
||||
TAILQ_REMOVE(&all_images, im, all_entry);
|
||||
all_images_count--;
|
||||
|
||||
TAILQ_REMOVE(&s->images, im, entry);
|
||||
TAILQ_REMOVE(im->list, im, entry);
|
||||
sixel_free(im->data);
|
||||
free(im->fallback);
|
||||
free(im);
|
||||
@@ -137,7 +135,8 @@ image_store(struct screen *s, struct sixel_image *si)
|
||||
image_fallback(&im->fallback, im->sx, im->sy);
|
||||
|
||||
image_log(im, __func__, NULL);
|
||||
TAILQ_INSERT_TAIL(&s->images, im, entry);
|
||||
im->list = &s->images;
|
||||
TAILQ_INSERT_TAIL(im->list, im, entry);
|
||||
|
||||
TAILQ_INSERT_TAIL(&all_images, im, all_entry);
|
||||
if (++all_images_count == MAX_IMAGE_COUNT)
|
||||
|
||||
Reference in New Issue
Block a user