зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1374572 - don't access disconnected remote binder. r=esawin
MozReview-Commit-ID: 6eYIbKgwRPd --HG-- extra : rebase_source : 863a2e107c6a47ce5d428b4697d0a6190fae4aae
This commit is contained in:
Родитель
6bd73cdf47
Коммит
c016f71d92
|
@ -59,15 +59,7 @@ public final class RemoteManager implements IBinder.DeathRecipient {
|
|||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
if (DEBUG) Log.d(LOGTAG, "service disconnected");
|
||||
try {
|
||||
mRemote.asBinder().unlinkToDeath(RemoteManager.this, 0);
|
||||
} catch (NoSuchElementException e) {
|
||||
Log.w(LOGTAG, "death recipient already released");
|
||||
}
|
||||
synchronized (this) {
|
||||
mRemote = null;
|
||||
notify();
|
||||
}
|
||||
unlink();
|
||||
}
|
||||
|
||||
private boolean connect() {
|
||||
|
@ -103,6 +95,19 @@ public final class RemoteManager implements IBinder.DeathRecipient {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void unlink() {
|
||||
if (mRemote == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
mRemote.asBinder().unlinkToDeath(RemoteManager.this, 0);
|
||||
} catch (NoSuchElementException e) {
|
||||
Log.w(LOGTAG, "death recipient already released");
|
||||
}
|
||||
mRemote = null;
|
||||
notify();
|
||||
}
|
||||
};
|
||||
|
||||
RemoteConnection mConnection = new RemoteConnection();
|
||||
|
@ -221,9 +226,8 @@ public final class RemoteManager implements IBinder.DeathRecipient {
|
|||
|
||||
private void release() {
|
||||
if (DEBUG) Log.d(LOGTAG, "release remote manager " + this);
|
||||
mConnection.unlink();
|
||||
Context appCtxt = GeckoAppShell.getApplicationContext();
|
||||
mRemote.asBinder().unlinkToDeath(this, 0);
|
||||
mRemote = null;
|
||||
appCtxt.unbindService(mConnection);
|
||||
}
|
||||
} // RemoteManager
|
Загрузка…
Ссылка в новой задаче