Spelt / ZXing.Delphi

ZXing Barcode Scanning object Pascal Library for Delphi VCL and Delphi Firemonkey
Apache License 2.0
471 stars 206 forks source link

TDecoderResult.Destroy - ByteSegments should not be cleared #153

Closed JedrzejczykRobert closed 1 year ago

JedrzejczykRobert commented 1 year ago

file: ZXing.DecoderResult; lines: 79-81

code:

  if Assigned(ByteSegments)
  then
     ByteSegments.Clear;

should be removed, because Count is 0, after extracted from result meta, for example:

if rs.ResultMetaData.ContainsKey(TResultMetaDataType.BYTE_SEGMENTS)  then
begin
  obj := rs.ResultMetaData.Items[TResultMetaDataType.BYTE_SEGMENTS];
  if Supports(obj, IByteSegmentsMetadata, bytesMetadata) then
  begin
    bytesMetadata.Value.Count; // Count is 0
  end;
end;