From 4fb55c15da1a563ab925914a0f493a3dc80495a3 Mon Sep 17 00:00:00 2001 From: Igor Murashkin Date: Thu, 29 Aug 2013 17:43:01 -0700 Subject: camera: Fix deadlock when sending callbacks during disconnect Bug: 10552448 Change-Id: Ie93ba744ae6705aa657f980ae8e08ec624feeb39 --- services/camera/libcameraservice/api2/CameraDeviceClient.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'services/camera/libcameraservice/api2') diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp index 289ba06..f147c06 100644 --- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp +++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp @@ -500,14 +500,12 @@ void CameraDeviceClient::onFrameAvailable(int32_t frameId, ATRACE_CALL(); ALOGV("%s", __FUNCTION__); - Mutex::Autolock icl(mBinderSerializationLock); - SharedCameraCallbacks::Lock l(mSharedCameraCallbacks); - - if (mRemoteCallback != NULL) { + // Thread-safe. No lock necessary. + sp remoteCb = mRemoteCallback; + if (remoteCb != NULL) { ALOGV("%s: frame = %p ", __FUNCTION__, &frame); - mRemoteCallback->onResultReceived(frameId, frame); + remoteCb->onResultReceived(frameId, frame); } - } // TODO: move to Camera2ClientBase -- cgit v1.1