win: fix an invalid cast from struct win to managed_win

Should always check if win::managed is true first.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-04-18 00:35:34 +01:00
parent bd4c242015
commit a96cdc7e15
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 2 additions and 2 deletions

View File

@ -1578,8 +1578,8 @@ static void finish_destroy_win(session_t *ps, struct managed_win **_w) {
// paint happened at least once, w->reg_ignore_valid would
// be true, and there is no need to invalid w->next->reg_ignore
// when w is destroyed.
if (!list_node_is_last(&ps->window_stack, &w->base.stack_neighbour)) {
auto next_w = list_next_entry(w, base.stack_neighbour); // XXX
auto next_w = win_stack_find_next_managed(ps, &w->base.stack_neighbour);
if (next_w) {
rc_region_unref(&next_w->reg_ignore);
next_w->reg_ignore_valid = false;
}