device: Fix macOS crash when unplugging device in threaded pipeline

Fixes #1082
This commit is contained in:
rdb 2020-12-26 12:45:13 +01:00
parent 5fd6436df5
commit 55d43a1d57
2 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Recommended maintenance release.
* Support building for macOS 11 "Big Sur" and "Apple Silicon" (arm64) * Support building for macOS 11 "Big Sur" and "Apple Silicon" (arm64)
* Fix a memory leak, particularly noticeable with multithreaded pipeline (#1077) * Fix a memory leak, particularly noticeable with multithreaded pipeline (#1077)
* Fix crash on macOS when unplugging device with threading active (#1082)
* Fix error with build_apps not working with certain versions of Python * Fix error with build_apps not working with certain versions of Python
* Fix DirectEntry/PGEntry flickering in the multithreaded pipeline (#1070) * Fix DirectEntry/PGEntry flickering in the multithreaded pipeline (#1070)
* Fix sounds resuming on reactivation if stop() was called while inactive (#559) * Fix sounds resuming on reactivation if stop() was called while inactive (#559)

View File

@ -111,6 +111,8 @@ add_device(InputDevice *device) {
*/ */
void InputDeviceManager:: void InputDeviceManager::
remove_device(InputDevice *device) { remove_device(InputDevice *device) {
// We need to hold a reference, since remove_device decrements the refcount.
PT(InputDevice) device_ref = device;
{ {
LightMutexHolder holder(_lock); LightMutexHolder holder(_lock);
_connected_devices.remove_device(device); _connected_devices.remove_device(device);