أيّهما أصح؟ تحرير المؤشرات في OnClose أم OnDestroy و مثال ذلكـ البرنامج التالي:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
public
end;
var
Form1: TForm1;
x,y,z:^integer;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
new(x);
new(y);
new(z);
x^:=100;
y^:=200;
showmessage('x = '+inttostr(x^)+' ,y = '+inttostr(y^));
z:=x;
x:=y;
y:=z;
showmessage('x = '+inttostr(x^)+' ,y = '+inttostr(y^));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
dispose(x);
dispose(y);
dispose(z);
end;
end.
مُداخلة غير مُتوقّعة أيّها الزميل Handoko وأشكُركـ على المعلومات القيّمة فلقد فهمتُ هذه النُّقطة.