mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-04 10:39:25 +00:00
Fixed PGP service leak
This commit is contained in:
parent
5a16ff468b
commit
b3bd37514e
1 changed files with 8 additions and 2 deletions
|
@ -119,7 +119,7 @@ public class PgpHelper {
|
||||||
Log.i("PGP binding to " + pkg + " timeout=" + timeout);
|
Log.i("PGP binding to " + pkg + " timeout=" + timeout);
|
||||||
|
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
OpenPgpServiceConnection pgpService = new OpenPgpServiceConnection(context.getApplicationContext(), pkg,
|
OpenPgpServiceConnection pgpService = new OpenPgpServiceConnection(context, pkg,
|
||||||
new OpenPgpServiceConnection.OnBound() {
|
new OpenPgpServiceConnection.OnBound() {
|
||||||
@Override
|
@Override
|
||||||
public void onBound(IOpenPgpService2 service) {
|
public void onBound(IOpenPgpService2 service) {
|
||||||
|
@ -142,8 +142,14 @@ public class PgpHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i("PGP bound=" + pgpService.isBound());
|
Log.i("PGP bound=" + pgpService.isBound());
|
||||||
if (!pgpService.isBound())
|
if (!pgpService.isBound()) {
|
||||||
|
try {
|
||||||
|
pgpService.unbindFromService();
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
}
|
||||||
throw new OperationCanceledException();
|
throw new OperationCanceledException();
|
||||||
|
}
|
||||||
|
|
||||||
return pgpService;
|
return pgpService;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue