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 <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-11-13 21:59:26 +00:00
parent 42cd5bca48
commit 9a88d971d5
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 5 additions and 2 deletions

View File

@ -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) { 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?) // 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) { if ((w->flags & WIN_FLAGS_PIXMAP_NONE) == 0) {
assert((w->flags & WIN_FLAGS_PIXMAP_STALE) == 0);
win_release_pixmap(backend, w); win_release_pixmap(backend, w);
} }
if ((w->flags & WIN_FLAGS_SHADOW_NONE) == 0) { if ((w->flags & WIN_FLAGS_SHADOW_NONE) == 0) {
assert((w->flags & WIN_FLAGS_SHADOW_STALE) == 0);
win_release_shadow(backend, w); win_release_shadow(backend, w);
} }
} }