Loading media/libstagefright/foundation/ALooperRoster.cpp +19 −7 Original line number Diff line number Diff line Loading @@ -72,6 +72,9 @@ void ALooperRoster::unregisterHandler(ALooper::handler_id handlerID) { } void ALooperRoster::unregisterStaleHandlers() { Vector<sp<ALooper> > activeLoopers; { Mutex::Autolock autoLock(mLock); for (size_t i = mHandlers.size(); i-- > 0;) { Loading @@ -81,6 +84,15 @@ void ALooperRoster::unregisterStaleHandlers() { if (looper == NULL) { ALOGV("Unregistering stale handler %d", mHandlers.keyAt(i)); mHandlers.removeItemsAt(i); } else { // At this point 'looper' might be the only sp<> keeping // the object alive. To prevent it from going out of scope // and having ~ALooper call this method again recursively // and then deadlocking because of the Autolock above, add // it to a Vector which will go out of scope after the lock // has been released. activeLoopers.add(looper); } } } } Loading Loading
media/libstagefright/foundation/ALooperRoster.cpp +19 −7 Original line number Diff line number Diff line Loading @@ -72,6 +72,9 @@ void ALooperRoster::unregisterHandler(ALooper::handler_id handlerID) { } void ALooperRoster::unregisterStaleHandlers() { Vector<sp<ALooper> > activeLoopers; { Mutex::Autolock autoLock(mLock); for (size_t i = mHandlers.size(); i-- > 0;) { Loading @@ -81,6 +84,15 @@ void ALooperRoster::unregisterStaleHandlers() { if (looper == NULL) { ALOGV("Unregistering stale handler %d", mHandlers.keyAt(i)); mHandlers.removeItemsAt(i); } else { // At this point 'looper' might be the only sp<> keeping // the object alive. To prevent it from going out of scope // and having ~ALooper call this method again recursively // and then deadlocking because of the Autolock above, add // it to a Vector which will go out of scope after the lock // has been released. activeLoopers.add(looper); } } } } Loading