Browse Source

Fix equality for UndoRedoState

In UndoRedoHelper, the .Equals call in Snapshot() did not call Equals(UndoRedoState other). It called the default Equals(object obj) implementation. This could throw of the undo redo snapshotting. Fix that by overriding Equals(object obj).
pull/6024/head
Deadpikle 5 years ago
parent
commit
2fe25f8acf
  1. 7
      src/Avalonia.Controls/TextBox.cs

7
src/Avalonia.Controls/TextBox.cs

@ -157,6 +157,13 @@ namespace Avalonia.Controls
}
public bool Equals(UndoRedoState other) => ReferenceEquals(Text, other.Text) || Equals(Text, other.Text);
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj.GetType() != GetType()) return false;
return Equals((UndoRedoState)obj);
}
}
private string _text;

Loading…
Cancel
Save