2020-3-25 17:40
MrOuzo
Bug in cnDebug.pas TraceObjectWithTag/LogObjectWithTag
Hello,
i think there is a bug in TraceObjectWithTag/LogObjectWithTag, the ATag is not evaluated
[code]procedure TCnDebugger.TraceObjectWithTag(AObject: TObject;
const ATag: string);
{$IFNDEF NDEBUG}
var
List: TStringList;
Intfs: string;
{$ENDIF}
begin
{$IFNDEF NDEBUG}
List := nil;
try
List := TStringList.Create;
try
AddObjectToStringList(AObject, List, 0);
Intfs := FormatObjectInterface(AObject);
if Intfs <> '' then
begin
List.Add('Supports Interfaces:');
List.Add(Intfs);
end;
except
List.Add(SCnObjException);
end;
TraceMsgWithType('Object: ' + IntToHex(Integer(AObject), CN_HEX_DIGITS) + SCnCRLF +
List.Text, cmtObject);
finally
List.Free;
end;
{$ENDIF}
end;[/code]
i think the new code is
[code]procedure TCnDebugger.TraceObjectWithTag(AObject: TObject;
const ATag: string);
{$IFNDEF NDEBUG}
var
List: TStringList;
Intfs: string;
{$ENDIF}
begin
{$IFNDEF NDEBUG}
List := nil;
try
List := TStringList.Create;
try
AddObjectToStringList(AObject, List, 0);
Intfs := FormatObjectInterface(AObject);
if Intfs <> '' then
begin
List.Add('Supports Interfaces:');
List.Add(Intfs);
end;
except
List.Add(SCnObjException);
end;
TraceMsgWithTypeTag('Object: ' + IntToHex(Integer(AObject), CN_HEX_DIGITS) + SCnCRLF +
List.Text, cmtObject, ATag); // <----- here
finally
List.Free;
end;
{$ENDIF}
end;[/code]