Remove dangling media recorder client reference when setCamera() is used.
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index cb8ab58..701259e 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -217,7 +217,13 @@
// allow anyone to use camera
LOGV("unlock (%p)", getCameraClient()->asBinder().get());
status_t result = checkPid();
- if (result == NO_ERROR) mClientPid = 0;
+ if (result == NO_ERROR) {
+ mClientPid = 0;
+
+ // we need to remove the reference so that when app goes
+ // away, the reference count goes to 0.
+ mCameraClient.clear();
+ }
return result;
}