From c618b5af98dec06d49374a61a5a94016f9fec2d3 Mon Sep 17 00:00:00 2001 From: Takeshi Aimi Date: Tue, 30 Nov 2010 16:27:42 +0900 Subject: DRM Framework bug fixes. - Make sure to clean-up obsolete listeners. - Close cursor after using it. - Add virtual destructor to the base class of OnInfoListener. Changes are made by SEMC and Sony. Change-Id: Ibb6dd625ef48e3597188f0d7c90f9d4c780b6139 --- drm/drmserver/DrmManager.cpp | 6 +++++- drm/libdrmframework/DrmManagerClient.cpp | 1 + drm/libdrmframework/DrmManagerClientImpl.cpp | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'drm') diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp index 537791c..49df1c8 100644 --- a/drm/drmserver/DrmManager.cpp +++ b/drm/drmserver/DrmManager.cpp @@ -117,7 +117,11 @@ status_t DrmManager::unloadPlugIns() { status_t DrmManager::setDrmServiceListener( int uniqueId, const sp& drmServiceListener) { Mutex::Autolock _l(mLock); - mServiceListeners.add(uniqueId, drmServiceListener); + if (NULL != drmServiceListener.get()) { + mServiceListeners.add(uniqueId, drmServiceListener); + } else { + mServiceListeners.removeItem(uniqueId); + } return DRM_NO_ERROR; } diff --git a/drm/libdrmframework/DrmManagerClient.cpp b/drm/libdrmframework/DrmManagerClient.cpp index fa3d52a..8bb00c3 100644 --- a/drm/libdrmframework/DrmManagerClient.cpp +++ b/drm/libdrmframework/DrmManagerClient.cpp @@ -31,6 +31,7 @@ DrmManagerClient::DrmManagerClient(): DrmManagerClient::~DrmManagerClient() { DrmManagerClientImpl::remove(mUniqueId); mDrmManagerClientImpl->removeClient(mUniqueId); + mDrmManagerClientImpl->setOnInfoListener(mUniqueId, NULL); delete mDrmManagerClientImpl; mDrmManagerClientImpl = NULL; } diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp index 32fa491..eea312b 100644 --- a/drm/libdrmframework/DrmManagerClientImpl.cpp +++ b/drm/libdrmframework/DrmManagerClientImpl.cpp @@ -81,7 +81,8 @@ status_t DrmManagerClientImpl::setOnInfoListener( int uniqueId, const sp& infoListener) { Mutex::Autolock _l(mLock); mOnInfoListener = infoListener; - return getDrmManagerService()->setDrmServiceListener(uniqueId, this); + return getDrmManagerService()->setDrmServiceListener(uniqueId, + (NULL != infoListener.get()) ? this : NULL); } status_t DrmManagerClientImpl::installDrmEngine(int uniqueId, const String8& drmEngineFile) { -- cgit v1.1