DelphiFAQ Home Search:
General :: Programming :: Delphi :: VCL
About the Delphi VCL (Visual Component Library)

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

Freeing a TList

If there is any possibility of the freeing code being called re-entrantly, make sure to store a nil in the list before freeing the object; your code should look like this:

// original from Ray Lischner
 for i := 0 to List.Count-1 do
 begin
   TempNode := List[i];
   List[i] := nil;
   TempNode.Free;
 end;
 List.Free;

Otherwise, the list would contain an invalid pointer. Even if you are not using multi-threading, Delphi has a few places where it is re-entrant.

Generated 20:01:27 on Jul 16, 2018