Sometimes I got EStackOverflow exception in my project. I use Delphi 2010 and latest version of VirtualTreeView. Report generated by Eurekalog contains infinite loop like this:
(this is a part of "Call stack" section of bugreport)
SetNodeHeight
MeasureItemHeight
GetNodeHeight
GetDisplayRect
InvalidateToBottom
SetNodeHeight
MeasureItemHeight
GetNodeHeight
GetDisplayRect
InvalidateToBottom
SetNodeHeight
MeasureItemHeight
GetNodeHeight
GetDisplayRect
All this lines is in VirtualTrees.pas, internal module of VirtualTreeView
The event handlers attached to the control are:
- TreeChange
- TreeCollapsing
- TreeFocusChanging
- TreeFreeNode
- TreeGetHint
- TreeMeasureItem
procedure TTrainingForm.TreeMeasureItem(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; var NodeHeight: Integer);
begin
inherited;
if Sender.MultiLine[Node] then
begin
try
TargetCanvas.Font := Sender.Font;
NodeHeight := TVirtualStringTree(Sender).
ComputeNodeHeight(TargetCanvas, Node, 0) + 4;
except
NodeHeight := 24;
end;
end
end;
I can't reproduce bug, but it happens sometimes in several sites.
How can I fix or workaround this problem?