Jump to content


tarnschaf

Member Since 23 Nov 2011
Offline Last Active Oct 21 2013 07:57 PM
-----

Topics I've Started

VirtualColumn seems broken

20 October 2013 - 12:06 AM

Hello,

after upgrading to nextcomps5_1013, my application throws AccessViolations in a form with a virtual column in a NextDBGrid.

It took me some hours to track it down:
- NextDBGrid keeps a collection of columns in the type TNxDBColumns, which returns all columns as TNxDBCustomColumn
- A virtual column is not a subclass of TNxDBCustomColumn but is anyway placed in this collection
- In TNextDBGrid I identified a dozen of places with if conditions to check if "column is TNxDBCustomColumn"
- These checks don't seem to work since in TNxDBColumns all objects are casted to TNxDBCustomColumn, so Delphi can't tell the real type any more.
- Thus, in TNextDBGrid.SetFieldObjects the virtual column is casted to TNxDBCustomColumn and then the Field property is set. I don't have to tell you that this results in accesses to uninitialized memory.

This occurs in Delphi 2007 but I assume other versions are affected as well. I would appreciate if you could look into this issue because virtual columns are a really useful feature.

Thanks,
Michael

By the way, my virus scanner (Avast) detected a trojan when accessing your forum this afternoon.