QuickLib
QuickLib copied to clipboard
"Access violation" exception when deleting with Linq
Hi,
To reproduce, please open "InterfacedLists" sample and add next line: ListObj.Where('Name = ?',['Lee']).Delete;
before cout('Press ENTER to Exit',ccYellow);. Run the sample, and when ENTER is pressed, "Access violation" exception is thrown.
Best regards,
Hi,
While the bug is resolved, I have been able to apply a workaround in the file Quick.Linq:
...
...
...
...
...
...

Best regards,
Thanks for your report. I made some fixes and improvements to linq and generics to solve this. Please check now if all is correct.
Hello,
Thank you for your support... I'm checking and now there is some kind of problem in the
Fields:=Table.Fields.Where('UI_Grid_Order > 0').OrderBy('UI_Grid_Order').Select()
Now, in some cases, with the same code as before, this select, that has to return 3 elements, seems to return first 3 elements correctly and nil for the rest, so Fields.Count returns 18 (incorrect) instead of 3. An access violation is raised when a loop tries to access the fourth element:
for Field in Table.Fields.Where('UI_Grid_Order > 0').OrderBy('UI_Grid_Order').Select() do
I don't know how to reproduce because I have two very very very similar situations, one works fine and the other has this problem...
Maybe this picture can help in some way:

Regards,
Hi,
I don't know if it's relevant: as I told you before, I have two very, very, very similar situations (same structure, different sets of data), one works fine and the other has this problem. I found that there is a difference between the code executed inside Quicklib (green is the correct case, red is the wrong one).

Both with exactly the same line of code:
Fields:=Table.Fields.Where('UI_Grid_Order > 0').OrderBy('UI_Grid_Order').Select()
Regards,
Hi, In the end I was able to reproduce this issue in a test case. I also attach as an image the output of this example. Regards,
Solved! Thanks to your testcase was more easy to find it.
Happy to contribute in some way to this fantastic library.