From a29414fce6b192ab9a7a37938a9596b8511ce06b Mon Sep 17 00:00:00 2001 From: Fabian Henneke Date: Sun, 23 Aug 2020 18:51:36 +0200 Subject: Prevent racing double commits on password creation (#1047) Co-authored-by: Harsh Shandilya (cherry picked from commit 2c8999c1bff1c82b047e7111d47c539fc6207336) --- CHANGELOG.md | 4 ++++ .../com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85f8cc94..ad0e7788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file. ## [1.11.2] - 2020-08-24 +### Fixed + +- Saving a password after creating it fails to finish commit operation + ## [1.11.1] - 2020-08-21 ### Fixed diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt index 1376dd04..44376c0a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt @@ -426,13 +426,15 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB returnIntent.putExtra(RETURN_EXTRA_USERNAME, username) } - lifecycleScope.launch { - commitChange( - getString( - R.string.git_commit_edit_text, - getLongName(fullPath, repoPath, editName) + if (editing) { + lifecycleScope.launch { + commitChange( + getString( + R.string.git_commit_edit_text, + getLongName(fullPath, repoPath, editName) + ) ) - ) + } } if (directoryInputLayout.isVisible && directoryInputLayout.isEnabled && oldFileName != null) { -- cgit v1.2.3