Skip to content

Handle more theme loop situations

Tobias Stoeckmann requested to merge tstoeckmann/libxcursor:loop into master

This is a follow up for commit f64a8cc1 resulting from https://bugs.freedesktop.org/show_bug.cgi?id=3603

The current loop detection only works for direct self references but not for transitive ones. Limiting the inheritance depth fixes this issue as suggested by Keith Packard.

I avoided the introduction of a recursion function. Instead I modified XcursorScanTheme to work iterative.

The current recursion code adds the "Inherits=..." line to heap and has an iteration variable to go through all themes listed in that line per recursion. This is covered with the newly introduced XcursorInherit struct with its fields "line" and "theme". Since "theme" points into "line", only "line" has to be freed eventually.

If a fixed inheritage limit of 32 is reached, the code stops processing and returns NULL. It also returns NULL if it detects the initial theme in one of the inheritages to break the loop early on.

Last but not least I removed the printf statement. The only situation in which libXcursor writes to stdout is when it is explicitly requested.

Signed-off-by: Tobias Stoeckmann tobias@stoeckmann.org

Merge request reports