delphi - How to fix EStackOverflow in VirtualTreeView? -


sometimes got estackoverflow exception in project. use delphi 2010 , latest version of virtualtreeview. report generated eurekalog contains infinite loop this:

(this part of "call stack" section of bugreport)

setnodeheight             measureitemheight       getnodeheight           getdisplayrect          invalidatetobottom      setnodeheight           measureitemheight getnodeheight           getdisplayrect          invalidatetobottom      setnodeheight           measureitemheight       getnodeheight           getdisplayrect        

all lines in virtualtrees.pas, internal module of virtualtreeview

screenshot

the event handlers attached 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]     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, happens in several sites.

how can fix or workaround problem?

in tbasevirtualtree.setnodeheight() body of function entered if node.nodeheight <> value. loop seems possible if supply 1 node different value each time in onmeasureitem event handler. first test, use constant value here , see if stack overflow disappears. if so, make debug output calculated item heights , check them if deterministic node. if not, source of problem. reduce complexity of code in onmeasureitem event handler find culprit.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -