From a9872aac5af98ac5a643304b062aa984c4642f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 11 Jul 2021 10:01:22 +0200 Subject: [PATCH] wayland: explicitly purge all SHM pixmaps when destroying window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All SHM pixmap cookies depend on the terminal instance’s memory address. Thus, after a terminal instance has been destroyed, shm pixmaps that belonged to it will never be purged automatically. --- wayland.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wayland.c b/wayland.c index bea6fb52..ed3ddffd 100644 --- a/wayland.c +++ b/wayland.c @@ -1475,6 +1475,14 @@ wayl_win_destroy(struct wl_window *win) wayl_win_subsurface_destroy(&win->scrollback_indicator); wayl_win_subsurface_destroy(&win->render_timer); + shm_purge(shm, shm_cookie_search(term)); + shm_purge(shm, shm_cookie_scrollback_indicator(term)); + shm_purge(shm, shm_cookie_render_timer(term)); + shm_purge(shm, shm_cookie_grid(term)); + + for (size_t i = 0; i < ALEN(win->csd.surface); i++) + shm_purge(shm, shm_cookie_csd(term, i)); + #if defined(HAVE_XDG_ACTIVATION) if (win->xdg_activation_token != NULL) xdg_activation_token_v1_destroy(win->xdg_activation_token);