Skip to content

Commit

Permalink
Bugfix: Concurrent updates of shown entries lead to crashes and/or fr…
Browse files Browse the repository at this point in the history
…ozen screens
  • Loading branch information
Rookiestyle committed Dec 26, 2020
1 parent 3615783 commit 9c82aa8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ColoredPassword.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
10 changes: 6 additions & 4 deletions src/SinglePwDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion version.info
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:
ColoredPassword:0.11.2
ColoredPassword:0.11.3
ColoredPassword!de:5
ColoredPassword!pl:2
ColoredPassword!ru:2
Expand Down

0 comments on commit 9c82aa8

Please sign in to comment.