Recent

Author Topic: myclipboard free freeandnil formclose exception  (Read 5417 times)

AlistairG

  • Jr. Member
  • **
  • Posts: 70
myclipboard free freeandnil formclose exception
« on: March 12, 2011, 11:50:34 pm »
Hi I am used to freeing self-created objects:
procedure Tmainform.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
myclipboard.Free;
end;

I can step through this without an error but as the inherant destruction methods progress then I get a external sigsegv error.
Obviously dont need to free the object, just wondering why anyone know?
thanks vm.
Alistair.
« Last Edit: March 13, 2011, 02:14:04 pm by Alistair George/Laz 2.4 »
Lazarus 0.9.28.2-10ubuntu1 r22277 FPC 2.4.0 i386-linux-gtk 2 (beta)
       My pledge - if I waste your time, I donate to Lazarus.

Laksen

  • Hero Member
  • *****
  • Posts: 802
    • J-Software
Re: myclipboard when free on formclose exception
« Reply #1 on: March 13, 2011, 01:15:18 am »
How do you create myclipboard?

AlistairG

  • Jr. Member
  • **
  • Posts: 70
Re: myclipboard when free on formclose exception
« Reply #2 on: March 13, 2011, 02:28:19 am »
How do you create myclipboard?
procedure Tmainform.FormCreate(Sender: TObject);
begin
myclipboard:=clipboard.Create;

I tried:
procedure Tmainform.exit1Click(Sender: TObject);
begin
myclipboard.Open;
myclipboard.close;
freeandnil(myclipboard);  //same error
mainform.close;
end;

same error.
so Ill leave it as myclipboard.close, which is a sort of tidy up.
Lazarus 0.9.28.2-10ubuntu1 r22277 FPC 2.4.0 i386-linux-gtk 2 (beta)
       My pledge - if I waste your time, I donate to Lazarus.

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Re: myclipboard when free on formclose exception
« Reply #3 on: March 13, 2011, 09:08:09 am »
Code: [Select]
Try the following:

[code ]if Assigned(MyClipboard) then
  FreeAndNil(MyClipboard);

AlistairG

  • Jr. Member
  • **
  • Posts: 70
Re: myclipboard when free on formclose exception
« Reply #4 on: March 13, 2011, 02:17:47 pm »
Code: [Select]
Try the following:

[code ]if Assigned(MyClipboard) then
  FreeAndNil(MyClipboard);

Still raises error. Without, no error.
Lazarus 0.9.28.2-10ubuntu1 r22277 FPC 2.4.0 i386-linux-gtk 2 (beta)
       My pledge - if I waste your time, I donate to Lazarus.

 

TinyPortal © 2005-2018