Use con_detach instead of TAILQ_REMOVE in floating

This commit is contained in:
Orestis Floros 2017-09-14 12:16:19 +03:00
parent 4e0bf58109
commit 60875c7bcb
No known key found for this signature in database
GPG Key ID: E9AD9F32E401E38F
1 changed files with 3 additions and 7 deletions

View File

@ -178,9 +178,7 @@ void floating_enable(Con *con, bool automatic) {
/* 1: detach the container from its parent */ /* 1: detach the container from its parent */
/* TODO: refactor this with tree_close_internal() */ /* TODO: refactor this with tree_close_internal() */
TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes); con_detach(con);
TAILQ_REMOVE(&(con->parent->focus_head), con, focused);
con_fix_percent(con->parent); con_fix_percent(con->parent);
/* 2: create a new container to render the decoration on, add /* 2: create a new container to render the decoration on, add
@ -335,12 +333,10 @@ void floating_disable(Con *con, bool automatic) {
Con *parent = con->parent; Con *parent = con->parent;
/* 1: detach from parent container */ /* 1: detach from parent container */
TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes); con_detach(con);
TAILQ_REMOVE(&(con->parent->focus_head), con, focused);
/* 2: kill parent container */ /* 2: kill parent container */
TAILQ_REMOVE(&(con->parent->parent->floating_head), con->parent, floating_windows); con_detach(con->parent);
TAILQ_REMOVE(&(con->parent->parent->focus_head), con->parent, focused);
/* clear the pointer before calling tree_close_internal in which the memory is freed */ /* clear the pointer before calling tree_close_internal in which the memory is freed */
con->parent = NULL; con->parent = NULL;
tree_close_internal(parent, DONT_KILL_WINDOW, true, false); tree_close_internal(parent, DONT_KILL_WINDOW, true, false);