QDoc: Ensure readIndexSection() does not create Nodes with null parent


readIndexSection() in QDocIndexFiles is used both for constructing
new Node (subclass) instances, and amending already created nodes
with new information. Therefore, the 'parent' node may or may not be
valid for an individual call of readIndexSection().

The only Node instance that is allowed to have a null parent is the
root NamespaceNode, and that node is not constructed by
QDocIndexFiles.

Not checking for a valid parent before constructing nodes leads to
potential memory leaks and/or null pointer dereferences if the
.index file being read is malformed.

Add such checks.

Fixes: QTBUG-146642
Pick-to: 6.11
Change-Id: I1a3b0af519980168ed3e2a5102bea697ba72cd87
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
commit22b5bba4d01ecfa7897d9ca568745637a31a70ae
parent41b8e42df3f92085e43f7689ca619955b87b651f
authorTopi Reinio <topi.reinio@qt.io>
committerTopi Reinio <topi.reinio@qt.io>
commit timeThu, 7 May 2026 12:37:46 +0000