mirror of
https://github.com/swaywm/sway.git
synced 2024-12-30 17:06:40 +01:00
comments + fixed leak
This commit is contained in:
parent
d2e1c660b1
commit
de5196dc1e
1 changed files with 8 additions and 7 deletions
|
@ -26,14 +26,11 @@ static void free_swayc(swayc_t *cont) {
|
||||||
if (!ASSERT_NONNULL(cont)) {
|
if (!ASSERT_NONNULL(cont)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO does not properly handle containers with children,
|
|
||||||
// TODO but functions that call this usually check for that
|
|
||||||
if (cont->children) {
|
if (cont->children) {
|
||||||
if (cont->children->length) {
|
// remove children until there are no more, free_swayc calls
|
||||||
int i;
|
// remove_child, which removes child from this container
|
||||||
for (i = 0; i < cont->children->length; ++i) {
|
while (cont->children->length) {
|
||||||
free_swayc(cont->children->items[i]);
|
free_swayc(cont->children->items[0]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
list_free(cont->children);
|
list_free(cont->children);
|
||||||
}
|
}
|
||||||
|
@ -409,9 +406,13 @@ swayc_t *swayc_active_workspace_for(swayc_t *cont) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
switch (cont->type) {
|
switch (cont->type) {
|
||||||
|
/* set root -> output */
|
||||||
case C_ROOT: cont = cont->focused;
|
case C_ROOT: cont = cont->focused;
|
||||||
|
/* set output -> workspace */
|
||||||
case C_OUTPUT: cont = cont->focused;
|
case C_OUTPUT: cont = cont->focused;
|
||||||
|
/* return workspace */
|
||||||
case C_WORKSPACE: return cont;
|
case C_WORKSPACE: return cont;
|
||||||
|
/* Find parent workspace */
|
||||||
default: return swayc_parent_by_type(cont, C_WORKSPACE);
|
default: return swayc_parent_by_type(cont, C_WORKSPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue