This is a fix for bug #3038 which was investigated by @BenJamesBen
who also proposed a fix in PR #3056
However, after discussing the matter, we agreed it would be better
to have a generic method in core to guard against the issue of
spurious drawing operations.
This commit adds the `Path.clean()` method that does exactly that,
as well as its documentation.