Skip to content

Allow to store InternalData also for (internal) root node #590

Closed
@romankassebaum

Description

For the TCustomVirtualExplorerTree which is part of the MustangPeakComponents, I need internal data for the root node.

The current implementation

{code: Delphi}
function TCustomVirtualStringTree.InternalData(Node: PVirtualNode): Pointer;
begin
if (Node = FRoot) or (Node = nil) or (FInternalDataOffset = 0) then
Result := nil
else
Result := PByte(Node) + Self.NodeDataSize + FInternalDataOffset;
end;
{code}

returns always nil for the root node. Since the memory for the internal data is allocated, there is no need to do so.
From my point of view the implementation should be changed to

{code: Delphi}
function TCustomVirtualStringTree.InternalData(Node: PVirtualNode): Pointer;
begin
if (Node = nil) or (FInternalDataOffset = 0) then
Result := nil
else
Result := PByte(Node) + Self.NodeDataSize + FInternalDataOffset;
end;
{code}

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions