-
Notifications
You must be signed in to change notification settings - Fork 255
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
TBaseVirtualTree.GetChildCount CRASH #884
Comments
I do not know what the new code does but somehow it creates an endless loop causing Stack overflow - most likely sending events that should not be sent. ????????????? |
Does reverting to old code have any consequences? |
The fix to #871 has undesired consequences. In your code you can use Node.ChildCount instead of Tree.ChildCount[Node] to avoid the unwanted initialization of the child nodes. See pyscripter/MustangpeakVirtualShellTools@3725172 for the fix. |
I think the code change was OK and the code in the derived class should be changed. Like |
I do not know if it is OK, but if ChildCount[Node] = 0 then if Node.ChildCount = 0 then should not produce different behavior. If ChildCount[Node] should not be accessed - it should be made private. Such unpredictable beahaviour is not good. You will end up in a position where this component lives its own life and you can not track what is happening. |
Fully agreed, see #832.
Well, that's what it did when I started in this project. But it still has a lot of techncial debts that often cannot be fixed without breaking chnages like this one. |
Breaking changes should be applied only if it is absolutely necessary and should be applied in a way that it is obvious for the existing code what should be changed - not to lead to such recursions. I am saying this with all my best feelings, but I see such breaking changes here quite often - actually every time I update. |
You suggested a breaking chnage yourself:
I often see the problem here that the bad breaking chnages are those suggested by the other users only. |
It is better to have an error in compile time and be able to fix it rather than run time. And I did not propose a breaking change - I proposed better implementation of your breaking change ;) |
I received a lot of complaints when doing breaking changes in the past. Please keep in mind that >99.9% of all uses of the ChildCount[] property are still valid after the change. Why break 100% of them? I don't think you make a lot of fans that way. |
Latest changes cause crash in:
https://github.com/TurboPack/MustangpeakVirtualshellTools/blob/master/Delphi/VirtualShellToolsDD.dpk
Old code works perfectly in latest sources:
function TBaseVirtualTree.GetChildCount(Node: PVirtualNode): Cardinal;
begin
if (Node = nil) or (Node = FRoot) then
Result := FRoot.ChildCount
else
Result := Node.ChildCount;
end;
The text was updated successfully, but these errors were encountered: