[0.4.12][NTOS:PNP] Workaround a BSOD with HDAUDIO during boot PR#1560 CORE-15874
Thanks to Thomas Faber, author of the patch.
I depend on external testers here for confirmation of effectiveness.
We think the problem was unhidden by 0.4.12-dev-757-g
789cfd3ddc6cd15d80db120d0ddcc1e7616ce85d
and surrounding works.
When traversing the device tree, keep a reference to the current device.
Devices can be deleted during the traversal, so in order to keep
the tree walk intact without use-after-free situations,
this just keeps the PDO around until we no longer need the device node.
It could be argued that this is a hack, however implementing it the "correct way"
(I haven't actually researched how Windows does this) is unlikely to be possible
with our current PNP manager -- so this should keep us going for a while.