Skip to content

Commit

Permalink
Stop walking window tree if we get zero
Browse files Browse the repository at this point in the history
It looks like some of the child windows are zero, which causes the next
call to XQueryTree to blow up.
  • Loading branch information
brndnmtthws committed Feb 24, 2024
1 parent 56a81ef commit 7059aa8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/x11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1384,8 +1384,13 @@ inline Window last_descendant(Display *display, Window parent) {
while (
XQueryTree(display, current, &_ignored, &_ignored, &children, &count) &&
count != 0) {
current = children[count - 1];
auto next = children[count - 1];
XFree(children);
if (next != 0) {
current = next;
} else {
break;
}
}

return current;
Expand Down

0 comments on commit 7059aa8

Please sign in to comment.