traverseChildren: fix crash due to range-for over children()


If the user code adds a new child to that list, it can detach
the list, and then the range-for is iterating over deleted memory.

This code was initially using Q_FOREACH which did exactly this,
the crash is a pitfall of the port to range-for

Pick-to: 6.10 6.9 6.8
Change-Id: Ic5a1e099766d359c35a17eb4fdfd78a9d8152cc1
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
commit4a302b4b9005b2cfc3a01ccfb67bab8002e4dc4d
parentbac06af12536f90472132b3aa4d65ad327653a0d
authorDavid Faure <david.faure@kdab.com>
committerDavid Faure <david.faure@kdab.com>
commit timeThu, 26 Jun 2025 14:21:01 +0200