From d06618ee31c11ac7ac6698f95444041a4785a5ab Mon Sep 17 00:00:00 2001 From: Chih-Chung Chang Date: Thu, 13 May 2010 15:14:24 +0800 Subject: Fix deadlock if the last reference of ICameraClient is removed in ICamera::connect() Change-Id: I34ab3e4f07435c62168175e9bb159022c8fb99f4 --- camera/Camera.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'camera/Camera.cpp') diff --git a/camera/Camera.cpp b/camera/Camera.cpp index 3346b1f..2fbddd5 100644 --- a/camera/Camera.cpp +++ b/camera/Camera.cpp @@ -92,7 +92,12 @@ void Camera::init() Camera::~Camera() { - disconnect(); + // We don't need to call disconnect() here because if the CameraService + // thinks we are the owner of the hardware, it will hold a (strong) + // reference to us, and we can't possibly be here. We also don't want to + // call disconnect() here if we are in the same process as mediaserver, + // because we may be invoked by CameraService::Client::connect() and will + // deadlock if we call any method of ICamera here. } int32_t Camera::getNumberOfCameras() -- cgit v1.1