Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetNodeData returns invalid data when (Node = Pointer(Self)) #12

Open
chuacw opened this issue Feb 28, 2022 · 1 comment
Open

GetNodeData returns invalid data when (Node = Pointer(Self)) #12

chuacw opened this issue Feb 28, 2022 · 1 comment
Assignees

Comments

@chuacw
Copy link

chuacw commented Feb 28, 2022

When Node is Pointer(Self) in GetNodeData, it should return nil, instead of returning @Node.Data, ie...
the code for GetNodeData should be updated to:

function TBaseVirtualTree.GetNodeData(Node: PVirtualNode): Pointer;
// Returns the address of the user defined data area in the node.
begin
  Assert((FNodeDataSize > 0) or not Assigned(Node), 'NodeDataSize not initialized.');
  if (FNodeDataSize <= 0) or (Node = nil) or (Node = FRoot) or (Node = Pointer(Self)) then
    Result := nil
  else
  begin
    Result := @Node.Data;
    Include(Node.States, vsOnFreeNodeCallRequired); // We now need to call OnFreeNode, see bug #323
  end;
end;

@romankassebaum
Copy link
Contributor

Could you please ask for this issue in the JAM version (https://github.com/JAM-Software/Virtual-TreeView)? The problem is that if I would change the code here then the two versions would diverge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants