From 9c82aa8a98ac7f13cad131a108503529b011b8e3 Mon Sep 17 00:00:00 2001 From: Rookiestyle Date: Sat, 26 Dec 2020 11:48:12 +0100 Subject: [PATCH] Bugfix: Concurrent updates of shown entries lead to crashes and/or frozen screens --- src/ColoredPassword.cs | 2 +- src/Properties/AssemblyInfo.cs | 4 ++-- src/SinglePwDisplay.cs | 10 ++++++---- version.info | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ColoredPassword.cs b/src/ColoredPassword.cs index fe07438..9c03520 100644 --- a/src/ColoredPassword.cs +++ b/src/ColoredPassword.cs @@ -69,7 +69,7 @@ private void Lv_DrawItem(object sender, DrawListViewItemEventArgs e) { AceColumn colPw = KeePass.Program.Config.MainWindow.FindColumn(AceColumnType.Password); string m = string.Empty; - if (((colPw == null) || colPw.HideWithAsterisks) && !SinglePwDisplay.PasswordShown(e.ItemIndex)) + if (((colPw == null) || colPw.HideWithAsterisks) && !SinglePwDisplay.PasswordShown(e.Item)) { //Let the OS draw in case no other handlers exist //If other handlers exist, we pass their value for DrawDefault diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index 8d08462..5c0ce98 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.11.2")] -[assembly: AssemblyFileVersion("0.11.2")] +[assembly: AssemblyVersion("0.11.3")] +[assembly: AssemblyFileVersion("0.11.3")] diff --git a/src/SinglePwDisplay.cs b/src/SinglePwDisplay.cs index 7dd0c32..dc314c0 100644 --- a/src/SinglePwDisplay.cs +++ b/src/SinglePwDisplay.cs @@ -89,7 +89,7 @@ private static void MainForm_UIStateUpdated(object sender, EventArgs e) } foreach (ListViewItem lvi in EntriesListView.Items) { - if (!PasswordShown(lvi.Index)) continue; + if (!PasswordShown(lvi)) continue; if (lvi.SubItems[iPwColIndex].Text != KeePassLib.PwDefs.HiddenPassword) continue; lvi.SubItems[iPwColIndex].Text = ((PwListItem)lvi.Tag).Entry.Strings.ReadSafe(KeePassLib.PwDefs.PasswordField); } @@ -170,11 +170,13 @@ private static int IndexOf(KeePassLib.PwEntry pe) return -1; } - public static bool PasswordShown(int idx) + public static bool PasswordShown(ListViewItem lvi) { if (!Enabled) return false; - if (EntriesListView.Items.Count < idx) return false; - KeePassLib.PwEntry pe = ((PwListItem)EntriesListView.Items[idx].Tag).Entry; + if (lvi == null) return false; + if (!(lvi.Tag is PwListItem)) return false; + KeePassLib.PwEntry pe = (lvi.Tag as PwListItem).Entry; + if (pe == null) return false; SingleItem si = m_lItems.Find(x => x.Entry.Uuid.Equals(pe.Uuid)); return si != null && !si.Hidden; diff --git a/version.info b/version.info index 5f0f78e..dc3a31b 100644 --- a/version.info +++ b/version.info @@ -1,5 +1,5 @@ : -ColoredPassword:0.11.2 +ColoredPassword:0.11.3 ColoredPassword!de:5 ColoredPassword!pl:2 ColoredPassword!ru:2