From 9a88d971d59ed8c33f9d8734cd0039d9fd6030a5 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 13 Nov 2019 21:59:26 +0000 Subject: [PATCH] win: fix assertion failure in win_release_images The assertion check for condition that are too board. If we get multiple root config event in a row, then we might find ourselves trying to release a image that was released in a previous backend destruction and is yet to be bound (IOW, the window will have IMAGES_NONE _and_ IMAGES_STALE set), causing the assertion to fail. This commit relax the check, so we don't check if STALE is set when NONE is set. Signed-off-by: Yuxuan Shui --- src/win.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/win.c b/src/win.c index 1e4a0d9..c77fcc2 100644 --- a/src/win.c +++ b/src/win.c @@ -313,15 +313,18 @@ bool win_bind_shadow(struct backend_base *b, struct managed_win *w, struct color } void win_release_images(struct backend_base *backend, struct managed_win *w) { - // we don't want to consider what we should do if the image we want to release is + // We don't want to decide what we should do if the image we want to release is // stale (do we clear the stale flags or not?) - assert((w->flags & WIN_FLAGS_IMAGES_STALE) == 0); + // But if we are not releasing any images anyway, we don't care about the stale + // flags. if ((w->flags & WIN_FLAGS_PIXMAP_NONE) == 0) { + assert((w->flags & WIN_FLAGS_PIXMAP_STALE) == 0); win_release_pixmap(backend, w); } if ((w->flags & WIN_FLAGS_SHADOW_NONE) == 0) { + assert((w->flags & WIN_FLAGS_SHADOW_STALE) == 0); win_release_shadow(backend, w); } }