From 0f975616d63a53aa8404546e50375dd7a8b4e0f2 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 29 Nov 2020 00:12:40 +0000 Subject: [PATCH] core: ensure stale flags aren't set in destroy_backend After 60f733d17c395e08226b0788790954d1c64065e7, we can be sure stale flags won't be seen in destroy_backend. Signed-off-by: Yuxuan Shui --- src/picom.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/picom.c b/src/picom.c index 439c624..17005c3 100644 --- a/src/picom.c +++ b/src/picom.c @@ -405,12 +405,15 @@ static void destroy_backend(session_t *ps) { // Unmapped windows could still have shadow images, but not pixmap // images assert(!w->win_image || w->state != WSTATE_UNMAPPED); - // Windows can still have stale flags set. For mapped windows, - // this can happen when destroy_backend is called before the stale - // flags are handled (e.g. when destroy_backend is called in - // session_destroy, or configure_root); for unmapped windows, this - // is because their stale flags aren't handled until they are - // mapped. + if (win_check_flags_any(w, WIN_FLAGS_IMAGES_STALE) && + w->state == WSTATE_MAPPED) { + log_warn("Stale flags set for mapped window %#010x " + "during backend destruction", + w->base.id); + assert(false); + } + // Unmapped windows can still have stale flags set, because their + // stale flags aren't handled until they are mapped. win_clear_flags(w, WIN_FLAGS_IMAGES_STALE); win_release_images(ps->backend_data, w); }