summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/foundation
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-10-18 15:06:04 -0700
committerAndreas Huber <andih@google.com>2010-10-18 15:06:04 -0700
commitf200777290d2e3e8b580c512cc0808eae9790705 (patch)
tree73dc5d30a8d51163f5bf88c3d745b23efd3cd4b7 /media/libstagefright/foundation
parentb5b39d2c348f54a40fc800c9efec17d7f1e8a486 (diff)
downloadframeworks_av-f200777290d2e3e8b580c512cc0808eae9790705.zip
frameworks_av-f200777290d2e3e8b580c512cc0808eae9790705.tar.gz
frameworks_av-f200777290d2e3e8b580c512cc0808eae9790705.tar.bz2
An attempt to unregister a handler that's no longer registered should not cause an assertion.
There are edge cases in which a handler attempts to unregister itself while on another thread a message fails to be delivered to that very handler and causes automatic unregistration. In this case the handler's good cleanup intentions are thwarted by the CHECK. Change-Id: I4e41b5e7b619159ecce4856c15cccca031a28b5b related-to-bug: 3101247 QA-impact: no(!!!) risk
Diffstat (limited to 'media/libstagefright/foundation')
-rw-r--r--media/libstagefright/foundation/ALooperRoster.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/media/libstagefright/foundation/ALooperRoster.cpp b/media/libstagefright/foundation/ALooperRoster.cpp
index 7683113..8aa1b15 100644
--- a/media/libstagefright/foundation/ALooperRoster.cpp
+++ b/media/libstagefright/foundation/ALooperRoster.cpp
@@ -54,7 +54,10 @@ void ALooperRoster::unregisterHandler(ALooper::handler_id handlerID) {
Mutex::Autolock autoLock(mLock);
ssize_t index = mHandlers.indexOfKey(handlerID);
- CHECK_GE(index, 0);
+
+ if (index < 0) {
+ return;
+ }
const HandlerInfo &info = mHandlers.valueAt(index);
@@ -84,7 +87,8 @@ void ALooperRoster::postMessage(
if (looper == NULL) {
LOGW("failed to post message. "
- "Target handler still registered, but object gone.");
+ "Target handler %d still registered, but object gone.",
+ msg->target());
mHandlers.removeItemsAt(index);
return;
@@ -111,7 +115,8 @@ void ALooperRoster::deliverMessage(const sp<AMessage> &msg) {
if (handler == NULL) {
LOGW("failed to deliver message. "
- "Target handler registered, but object gone.");
+ "Target handler %d registered, but object gone.",
+ msg->target());
mHandlers.removeItemsAt(index);
return;