Fix stack overflow caused by recursive calls of destructors


When a deeply nested SVG file runs on a platform with a limited
stack size, recursive calls of destructors will lead to a stack
overflow. This fix adds a function in QSvgDocument that will
flatten the tree resulting in a stack depth of 1. This function
will not be called when AssumeTrustedSource flag is set to true.

Task-number: QTBUG-145916
Pick-to: 6.11
Change-Id: I0fbdeb8222ca39c2db091ebb1ad5c5c4ad44633a
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
commit22d503993d156d89086f1a68c76670cbc7130be0
parent6bd4300acfafbe46cc2324332cc9ba3cf24744b3
authorHatem ElKharashy <hatem.elkharashy@qt.io>
committerHatem ElKharashy <hatem.elkharashy@qt.io>
commit timeTue, 12 May 2026 10:55:58 +0000