Fix logging missing ref duplicates

#3018
This commit is contained in:
Wojtek Figat
2024-10-25 17:27:28 +02:00
parent 1f71a5a2e5
commit 6af788b20c
2 changed files with 11 additions and 1 deletions

View File

@@ -54,12 +54,17 @@ void LogContext::Print(LogType verbosity)
StringBuilder msg;
for (int32 index = (int32)stack.Count - 1; index >= 0; index--)
{
LogContextData& context = stack.Ptr[index];
// Skip duplicates
if (index < stack.Count - 1 && stack.Ptr[stack.Count - 1] == context)
continue;
// Build call hierarchy via indentation
msg.Clear();
for (uint32 i = index; i < stack.Count; i++)
msg.Append(indentation);
LogContextData& context = stack.Ptr[index];
if (context.ObjectID != Guid::Empty)
{
// Object reference context

View File

@@ -20,6 +20,11 @@ API_STRUCT(NoDefault) struct FLAXENGINE_API LogContextData
/// A GUID for an object which this context applies to.
/// </summary>
API_FIELD() Guid ObjectID;
friend bool operator==(const LogContextData& lhs, const LogContextData& rhs)
{
return lhs.ObjectID == rhs.ObjectID;
}
};
template<>