CoreAudio: take ownership of disconnect listener blocks


DeviceDisconnectMonitor stored the HAL listener block in a
shared_ptr without retaining it, relying on ARC lifetime
semantics in a file compiled without ARC. Once the
autorelease pool drained, only CoreAudio held the block, so
the first removal freed it and any later removal passed a
dangling pointer to AudioObjectRemovePropertyListenerBlock.

Copy the block with Block_copy on registration and release
it in the deleter, skip removal when the device is no longer
alive, and retire each registration at most once by tracking
it in m_state.

Pick-to: 6.12
Fixes: QTBUG-151116
Change-Id: Ib810c2357497ebe1a632db0801cfc9cf6c6cf771
Reviewed-by: Nils Petter Skålerud <nils.petter.skalerud@qt.io>
commitfe815c8c8afe2d05caa6af8082ed2756438257f5
parent784de078d2c88a9576afb0c915ae5f017a3e5ca8
authorTim Blechmann <tim.blechmann@qt.io>
committerTim Blechmann <tim.blechmann@qt.io>
commit timeTue, 6 Oct 2026 22:58:29 +0000