From b35084062d7eb91544d04f235e2a8fd5c3871526 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 28 Jan 2021 15:06:18 +0530 Subject: [PATCH] Remove old data from cache when re-using image objects --- kitty/graphics.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kitty/graphics.c b/kitty/graphics.c index b2a03cd6f..f44c59fcf 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -579,6 +579,7 @@ handle_add_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_ if (send_to_gpu) { send_image_to_gpu(&img->texture_id, img->load_data.data, img->width, img->height, img->is_opaque, img->is_4byte_aligned, false, REPEAT_CLAMP); } + if (img->root_frame.id) remove_from_cache(self, (const ImageAndFrame){.image_id=img->internal_id, .frame_id=img->root_frame.id}); img->root_frame.id = ++img->frame_id_counter; if (!add_to_cache(self, (const ImageAndFrame){.image_id = img->internal_id, .frame_id=img->root_frame.id}, img->load_data.data, img->load_data.data_sz)) { if (PyErr_Occurred()) PyErr_Print();