QXmlStream: check that DTD elements don't leak from doc to doc


They do :(

All of them, actually, in various forms: when the second document's
DTD is absent, dtdName, dtdPublicId, and dtdSystemId are not reset,
but thankfully their getters have a guard for TokenType == DTD, so
it's not observable (data members only). For notationDeclarations()
and entityDeclarations(), the leak _is_ observable: if the first
document didn't call one of them, the respective `xDeclarations` data
member was never cleared, the `publicXDeclations` data member never
populated, so a call to them in the second document will use the data
collected in the first.

Amends the start of the public history. Picking the check back to all
branches, to confirm this is not a recent regression. The fix, as
usual, I would only pick to 6.8, because the workaround is again the
same: don't reuse QXmlStreamReader instances.

Pick-to: 6.12 6.8 6.5 5.15
Task-number: QTBUG-151675
Change-Id: I37d0d4dd39945c9cb3bc41aa764ef27dbc654776
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt Review Bot <qt_reviewbot@qt-project.org>
commit6d0c5860b1e21da8735f196223223dfc40d3afc2
parent1e1d86a009423fa834c361d34be250b0c4c5a49e
authorMarc Mutz <marc.mutz@qt.io>
committerMarc Mutz <marc.mutz@qt.io>
commit timeWed, 21 Oct 2026 10:58:21 +0000