Q
qlw
Unregistered / Unconfirmed
GUEST, unregistred user!
试验代码如下
procedure TForm1.Button1Click(Sender: TObject);
begin
aa[1]:=Tedit.Create(self);// 数组元素赋值
end;
procedure TForm1.Button3Click(Sender: TObject);
var i:integer;
begin
for i:=0 to 2 do begin
if aa<>nil then //如元素非空,则释放 ???
showmessage(inttostr(i)+'is not nil,freeing it...');
aa.free;
end;
end;
跟踪显示aa[1]并未被释放,即总是不为空
出现访问冲突,请问如何解决?
procedure TForm1.Button1Click(Sender: TObject);
begin
aa[1]:=Tedit.Create(self);// 数组元素赋值
end;
procedure TForm1.Button3Click(Sender: TObject);
var i:integer;
begin
for i:=0 to 2 do begin
if aa<>nil then //如元素非空,则释放 ???
showmessage(inttostr(i)+'is not nil,freeing it...');
aa.free;
end;
end;
跟踪显示aa[1]并未被释放,即总是不为空
出现访问冲突,请问如何解决?