Fix cycle detection in <use> elements
In 0332df304f013ded362537c1f61556098b875352, the cycle
detection was moved to an earlier point in parsing, which
broke cycle detection for the <use> element, since the links
in <use> are not resolved until the end of parsing,
when resolveNodes() is called.
This adds an additional cycle check at the end of parsing
as well.
Pick-to: 6.8 6.9
Change-Id: I13278aa187020df70673f388d76ab609c1ec168b
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>