зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1530715 - P23: Avoid poisoning the mutex for device_changed_callback. r=padenot
The mutex is considered poisoned whenever a thread panics while holding the mutex. Registering a second device changed callback without unregistering the original callback makes the thread panics while holding the mutex for the device_changed_callback. This mutex will be used when device property changed callback. If the mutex is poisoned then a device property is changed, we will get another panic when firing the callback because of using a poisoned mutex. Differential Revision: https://phabricator.services.mozilla.com/D34056 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b7048aa82e
Коммит
9cbaedd2cd
|
@ -3,4 +3,4 @@ git repository using the update.sh script.
|
|||
|
||||
The cubeb-coreaudio-rs git repository is: https://github.com/ChunMinChang/cubeb-coreaudio-rs
|
||||
|
||||
The git commit ID used was 3608c1dfc46466df5de8f03eca148f16a5dcd732 (2019-06-21 15:51:40 -0700)
|
||||
The git commit ID used was 883d9919065abde325502a65ae265998ed046b91 (2019-06-21 15:51:40 -0700)
|
||||
|
|
|
@ -4371,10 +4371,13 @@ impl<'ctx> StreamOps for AudioUnitStream<'ctx> {
|
|||
let mut callback = self.device_changed_callback.lock().unwrap();
|
||||
// Note: second register without unregister first causes 'nope' error.
|
||||
// Current implementation requires unregister before register a new cb.
|
||||
assert!(device_changed_callback.is_none() || callback.is_none());
|
||||
if device_changed_callback.is_some() && callback.is_some() {
|
||||
Err(Error::invalid_parameter())
|
||||
} else {
|
||||
*callback = device_changed_callback;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<'ctx> Send for AudioUnitStream<'ctx> {}
|
||||
|
|
Загрузка…
Ссылка в новой задаче