CoreAudio: fix use-after-free on device disconnect


The disconnect continuation is posted to the parent's thread via
QFuture::then(). If the stream is destroyed (e.g. by
QAudioSink::reset()) after the HAL reported the disconnect but before
the posted continuation runs, the parent is still alive, so the
continuation still runs and touches the freed stream.

cancelChain() on the continuation alone is not sufficient: once the
parent future has finished, the link between them is concluded and
the queued continuation no longer observes the cancellation. Keep
the parent future returned by DeviceDisconnectMonitor and cancel it
together with the continuation in cancelDisconnectFutures().

Task-number: QTBUG-151333
Pick-to: 6.12
Change-Id: Ia7f63c88f44aaa4768947b51d76f4cef663c1e75
Reviewed-by: Nils Petter Skålerud <nils.petter.skalerud@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
commit3b0a493a15ebe3e81ae42700686c92628dd7b86d
parent60779a19640081856ae8de25fa07487baae4fed3
authorTim Blechmann <tim.blechmann@qt.io>
committerTim Blechmann <tim.blechmann@qt.io>
commit timeTue, 13 Oct 2026 00:38:28 +0000