Fix transient_for endless loop

Other approaches would be:
- Slow/fast pointer technique.
- Using a set/associative map to save 'seen' nodes. i3 does not have
  such data structure.

Counting the total amount of windows is the simpler to implement.

I've also extracted the logic in a function and re-used it in render.c.

Fixes #4404
This commit is contained in:
Orestis Floros
2021-11-11 20:14:22 +01:00
parent 43e805a00d
commit e1d3e6b2f6
6 changed files with 92 additions and 45 deletions

View File

@ -208,6 +208,14 @@ Con *con_by_frame_id(xcb_window_t frame);
*/
Con *con_by_mark(const char *mark);
/**
* Start from a container and traverse the transient_for linked list. Returns
* true if target window is found in the list. Protects againsts potential
* cycles.
*
*/
bool con_find_transient_for_window(Con *start, xcb_window_t target);
/**
* Returns true if and only if the given containers holds the mark.
*