Generic TList - move overwrites existing item

List_move.zip (13.0 KB)

The behavior is different with TList.Move in Web vs VCL, in web it appears to duplicate the entry instead of moving it to the new position. The destination is overwritten with a copy of the item to be moved.

A minimal example is attached for VCL and Web, and you can see the differences.

For my specific bug, I can change my code to exchange items and just create them in a different order, but It is a behavior difference between VCL and Web so it would be nice to understand root cause and fix it to match.

Possibly this is a known defect, but I could not find it in the Gitlab list.

Thank you,
Neil Laskowski

Radio Group item changed to 0 selection = Move
--Begin Dump Defect list
Item index = 0 has value :Feature Request ID = 0
--End Dump Defect list
Item added, index = 0
move
Item added, index = 1
--Begin Dump Defect list
Item index = 0 has value :Major Failure ID = 1
Item index = 1 has value :Major Failure ID = 1
--End Dump Defect list
Item added, index = 2
--Begin Dump Defect list
Item index = 0 has value :Minor Warning ID = 2
Item index = 1 has value :Major Failure ID = 1
Item index = 2 has value :Minor Warning ID = 2
--End Dump Defect list
Item added, index = 3
--Begin Dump Defect list
Item index = 0 has value :Enhancement ID = 3
Item index = 1 has value :Major Failure ID = 1
Item index = 2 has value :Minor Warning ID = 2
Item index = 3 has value :Enhancement ID = 3
--End Dump Defect list

Thanks for reporting.
We'll take this up with the pas2js team as this concerns pas2js RTL.

I created a merge request with the PAS2JS team, the fix was simpler than shuffling my own code.

Are the tests in Core Source\Tests being maintained or in a repo somewhere that can be contributed to?
I wrote some unit tests today that could be added, they are attached here
GenericCollectionsTests.pas (10.8 KB)

We can confirm this fix has been synchronized.
Next TMS WEB Core release will have it.
We will also integrate these tests. Thanks for sharing these!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.