Skip to content

Commit

Permalink
Don't create a new OpenPgpServiceConnection when there already is one
Browse files Browse the repository at this point in the history
Doing so would leak the ServiceConnection created by the previous
OpenPgpServiceConnection.
  • Loading branch information
cketti committed Feb 14, 2020
1 parent 5dce110 commit bfbb744
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ private void setupCryptoProvider() {
return;
}

if (openPgpServiceConnection != null) {
// An OpenPgpServiceConnection has already been created, but hasn't been bound yet.
// We'll just wait for OnBound.onBound() to be called.
return;
}

setOpenPgpProviderState(OpenPgpProviderState.UNINITIALIZED);
openPgpServiceConnection = new OpenPgpServiceConnection(context, openPgpProvider, new OnBound() {
@Override
Expand Down

0 comments on commit bfbb744

Please sign in to comment.