JAM-Software / Virtual-TreeView

Virtual Treeview is a Delphi treeview control
http://www.jam-software.de/virtual-treeview/
641 stars 248 forks source link

Height overflow when adding large number of nodes #1260

Open jin-x opened 2 months ago

jin-x commented 2 months ago

Hello.

When setting large number of nodes (e.g. 200 millions) then the value of NewHeight overflows in method TBaseVirtualTree.SetChildCount (look here). Because it have type TDimension = Integer (defined here). So list is fixed (doesn't move), vertical scroll bar is absent and exception occurs in Debug mode.

joachimmarder commented 2 months ago

Please respect our guidelines on the project homepage for submitting bugs. Please include your version of Virtual TreeView and Delphi, and attach a sample compiling project as ZIP to your report that allows to replicate the problem. If only small changes are required, a description is sufficient how a demo projects needs to be changed in order to replicate the bug. If you already have a solution, please supply a patch file.

joachimmarder commented 2 months ago

When setting large number of nodes (e.g. 200 millions) t

I honestly don't think it is a good idea to present 200 million nodes to a user, even if that would be theortically and technically possible.

Because it have type TDimension = Integer

Where possible we could use NativeInt instead of Integer. That way we can overcome this limit in Win64 applications.

joachimmarder commented 2 months ago

I gave it a try, let me know what you think.

jin-x commented 2 months ago

@joachimmarder, thanks for answers and sorry for wrong report design. RAD Studio 12.1 (version 29.0.51961.7529). VirtualTreeView version 8.0.3. Demo project: HeightErrorDemo.zip There's 50 million nodes with large font size.

Unfortunately, your fix with TNodeHeight alias did not solve the problem, in fact nothing has changed :(

joachimmarder commented 2 months ago

I used the new type TNodeHeight at a few more places and the control now displays correctly, but you can't scroll to the bottom. The problem is that certain type like the Win32 SCROLLINFO struct and TRect are based on Integer (Int32) and so are limited to 2^31 pixels.

I still don't think it is a good idea to present >50 million nodes to a user.