diff options
author | Marco Nelissen <marcone@google.com> | 2014-08-28 12:40:34 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2014-08-28 12:40:34 -0700 |
commit | 0b0f6075377260e006e860e3ba296f5504a6c891 (patch) | |
tree | 45decc925694485dbecd1aafebc2c84ac6b50fe0 /media/libstagefright | |
parent | 047dd13ca42ff7cea10821ef64eb09229fa3e751 (diff) | |
download | frameworks_av-0b0f6075377260e006e860e3ba296f5504a6c891.zip frameworks_av-0b0f6075377260e006e860e3ba296f5504a6c891.tar.gz frameworks_av-0b0f6075377260e006e860e3ba296f5504a6c891.tar.bz2 |
Move stale handler cleanup to constructor
This avoids the potential side effect of deleting more ALoopers
inside the cleanup loop.
Bug: 17059501
Change-Id: I41efaf490449b95fedfe01175f3b19067d50da24
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/foundation/ALooper.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/media/libstagefright/foundation/ALooper.cpp b/media/libstagefright/foundation/ALooper.cpp index ebf9d8d..88b1c92 100644 --- a/media/libstagefright/foundation/ALooper.cpp +++ b/media/libstagefright/foundation/ALooper.cpp @@ -68,14 +68,14 @@ int64_t ALooper::GetNowUs() { ALooper::ALooper() : mRunningLocally(false) { + // clean up stale AHandlers. Doing it here instead of in the destructor avoids + // the side effect of objects being deleted from the unregister function recursively. + gLooperRoster.unregisterStaleHandlers(); } ALooper::~ALooper() { stop(); - - // Since this looper is "dead" (or as good as dead by now), - // have ALooperRoster unregister any handlers still registered for it. - gLooperRoster.unregisterStaleHandlers(); + // stale AHandlers are now cleaned up in the constructor of the next ALooper to come along } void ALooper::setName(const char *name) { |