From: Igor Murashkin Date: Fri, 30 Aug 2013 00:43:01 +0000 (-0700) Subject: camera: Fix deadlock when sending callbacks during disconnect X-Git-Tag: android-x86-4.4-r1~164^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4fb55c15da1a563ab925914a0f493a3dc80495a3;p=android-x86%2Fframeworks-av.git camera: Fix deadlock when sending callbacks during disconnect Bug: 10552448 Change-Id: Ie93ba744ae6705aa657f980ae8e08ec624feeb39 --- diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp index 289ba06653..f147c06e24 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