From: Orestis Floros Date: Thu, 14 Sep 2017 09:16:19 +0000 (+0300) Subject: Use con_detach instead of TAILQ_REMOVE in floating X-Git-Tag: 4.16~105^2~4 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=60875c7bcb447baaec8410fc49a3f82bc9e1c388 Use con_detach instead of TAILQ_REMOVE in floating --- diff --git a/src/floating.c b/src/floating.c index 1bc4996a..dcf73b41 100644 --- a/src/floating.c +++ b/src/floating.c @@ -178,9 +178,7 @@ void floating_enable(Con *con, bool automatic) { /* 1: detach the container from its parent */ /* TODO: refactor this with tree_close_internal() */ - TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes); - TAILQ_REMOVE(&(con->parent->focus_head), con, focused); - + con_detach(con); con_fix_percent(con->parent); /* 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; /* 1: detach from parent container */ - TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes); - TAILQ_REMOVE(&(con->parent->focus_head), con, focused); + con_detach(con); /* 2: kill parent container */ - TAILQ_REMOVE(&(con->parent->parent->floating_head), con->parent, floating_windows); - TAILQ_REMOVE(&(con->parent->parent->focus_head), con->parent, focused); + con_detach(con->parent); /* clear the pointer before calling tree_close_internal in which the memory is freed */ con->parent = NULL; tree_close_internal(parent, DONT_KILL_WINDOW, true, false);