My code (which loads and saves TElTree properties via the component streaming system) was getting an AV while reading tree items. The tree has VirtualityLevel set to vlTextAndStyles.
Tracing the code through, the crash seems to happen in TElTreeItem.ReadData, around line 12830
Stream.ReadBuffer(SI, sizeof(TStyleInfo));
with MainStyle do
begin
FCellBkColor := SI.FCellBkColor; // We crash here.
FTextBkColor := SI.FTextBkColor;
The problem seems to be that MainStyle returns nil for virtualized items, and there's no check for this. I added the necessary test. (and moved the FFontName assignment within the block, and my code seems to now run correctly.
I was unable to duplicate the crash within the IDE, but I'm pretty sure this is the cause of my problem,
Comments