am d400d03f: Merge "Fix issue #5595933: GREF leak due to race condition in..." into ics-mr1

* commit 'd400d03f4a6384449f8b0d3c8a9aa7e1e8aa5a16':
  Fix issue #5595933: GREF leak due to race condition in...
This commit is contained in:
Dianne Hackborn
2011-11-11 14:26:30 -08:00
committed by Android Git Automerger

View File

@@ -901,6 +901,7 @@ public final class LoadedApk {
private RuntimeException mUnbindLocation;
private boolean mDied;
private boolean mForgotten;
private static class ConnectionInfo {
IBinder binder;
@@ -959,6 +960,7 @@ public final class LoadedApk {
ci.binder.unlinkToDeath(ci.deathMonitor, 0);
}
mActiveConnections.clear();
mForgotten = true;
}
}
@@ -1020,6 +1022,11 @@ public final class LoadedApk {
ServiceDispatcher.ConnectionInfo info;
synchronized (this) {
if (mForgotten) {
// We unbound before receiving the connection; ignore
// any connection received.
return;
}
old = mActiveConnections.get(name);
if (old != null && old.binder == service) {
// Huh, already have this one. Oh well!