Skip to content

Commit d400d03

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Fix issue #5595933: GREF leak due to race condition in..." into ics-mr1
2 parents 847fbbe + 5a6ef73 commit d400d03

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/java/android/app/LoadedApk.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,7 @@ static final class ServiceDispatcher {
901901
private RuntimeException mUnbindLocation;
902902

903903
private boolean mDied;
904+
private boolean mForgotten;
904905

905906
private static class ConnectionInfo {
906907
IBinder binder;
@@ -959,6 +960,7 @@ void doForget() {
959960
ci.binder.unlinkToDeath(ci.deathMonitor, 0);
960961
}
961962
mActiveConnections.clear();
963+
mForgotten = true;
962964
}
963965
}
964966

@@ -1020,6 +1022,11 @@ public void doConnected(ComponentName name, IBinder service) {
10201022
ServiceDispatcher.ConnectionInfo info;
10211023

10221024
synchronized (this) {
1025+
if (mForgotten) {
1026+
// We unbound before receiving the connection; ignore
1027+
// any connection received.
1028+
return;
1029+
}
10231030
old = mActiveConnections.get(name);
10241031
if (old != null && old.binder == service) {
10251032
// Huh, already have this one. Oh well!

0 commit comments

Comments
 (0)