After discovering that we had some basic memory leaks I've been giving some of our applications a spring clean. After plugging FastMM4 into one of our applications I'm getting an abstract error that appears to be when I clear a list of frames
I have a Form with a scroll box on it. The scrollbox has either a list of results or details. The results and details are both designed in frames.
First I get a batch of results (upto 25 records) and create the appropriate # of frames
var
Framelist: TList;
NewSF: TSF;
begin
Framelist := TList.Create;
for i := 0 to Batch.Count - 1 do
begin
NewSF := TSF.Create(nil);
NewSF.Name := 'SF' + IntToStr(i);
NewSF.Parent := ScrollBox1;
FrameList.Add(NewSF);
end;
end;
When a frame is clicked on the result frames are clear and a detail frame created on the scrollbox in their place. I have currently deactivated the creation of the detail frame and am concentrating on clearing the frames.
The frames were initially being cleared like this:
while FrameList.Count > 0 do
begin
TSF(FrameList[0]).free;
FrameList.delete(0);
end;
I have also tried like this:
for i := 0 to FrameList.Count - 1 do
begin
SF := FrameList[i];
SF.Free;
SF := nil;
end;
Any suggestions on what I am doing wrong - either on creation or destruction?