From b5950d9b27f28d4b62f533b4df728e1170aacd62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 11 Jul 2021 09:59:25 +0200 Subject: [PATCH] wayland: purge CSD pixmaps when destroying the CSDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CSDs aren’t typically toggled on and off. Thus, when disabled, immediately purge their corresponding pixmap buffers, to free up some memory, and release file descriptors. --- wayland.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wayland.c b/wayland.c index ecc4f31e..bea6fb52 100644 --- a/wayland.c +++ b/wayland.c @@ -51,8 +51,13 @@ csd_instantiate(struct wl_window *win) static void csd_destroy(struct wl_window *win) { - for (size_t i = 0; i < ALEN(win->csd.surface); i++) + struct terminal *term = win->term; + struct wl_shm *shm = term->wl->shm; + + for (size_t i = 0; i < ALEN(win->csd.surface); i++) { wayl_win_subsurface_destroy(&win->csd.surface[i]); + shm_purge(shm, shm_cookie_csd(term, i)); + } } static void