Browse Source

Fix `MutableText`'s hash code not bein constant

`MutableText`'s hash code was previously dependent on it's contents,
allowing it to change without reallocation. This patch fixes that.
pull/8/head
Anton Tarasenko 4 years ago
parent
commit
3e44a54977
  1. 12
      sources/Text/MutableText.uc

12
sources/Text/MutableText.uc

@ -351,6 +351,18 @@ private final function FormattedBlock CreateFormattedBlock(bool isOpening)
return newBlock; return newBlock;
} }
/**
* Unlike `Text`, `MutableText` can change it's content and therefore it's
* hash code cannot depend on it. So we restore `AcediaObject`'s behavior and
* return random value, generated at the time of allocation.
*
* @return Hash code for the caller `MutableText`.
*/
public function int GetHashCode()
{
return super(AcediaObject).GetHashCode();
}
defaultproperties defaultproperties
{ {
} }
Loading…
Cancel
Save