Lazarus
Programming => LCL => Topic started by: sirharlekin on September 17, 2013, 11:48:35 am
-
Hi all,
I've the following problem:
- When I close a TFrame with the following code under Windows, I get an SIG error!
- Under Linux it works perfect.
uses
Classes, SysUtils, FileUtil, Forms, Controls, ExtCtrls, ComCtrls, Buttons,
ActnList, StdCtrls;
type
TModuleFrame = class(TFrame)
Close: TAction;
Actionlist: TActionList;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Menubar: TToolBar;
Toppanel: TPanel;
Leftpanel: TPanel;
procedure BitBtn1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
implementation
{$R *.lfm}
procedure TModuleFrame.BitBtn1Click(Sender: TObject);
begin
self.Free;
end;
end.
Question:
- Is this a knowing bug or is ther something wrong in my code?
- What's the workaround?
-
Destroying an object in an event (of an object owned by said object) might not be such a good idea.
Bart
-
Hi Bart,
thanks for youre response, but do you have a solution for this problem?
Michael
-
call release (it exists in the forms I'm not about the frames) or use the application.AsyncCall Mechanism to class it after the event is finished executing, although this reminds of a bug I encountered in past that had to do with the use of freeThenNill instead of FreeanAndNil procedures in the library I think that it has been patched already but you should check to see which one is used when the owned objects are destroyed inside the frame's destruction process to make sure.
-
self.hide
application.releaseComponent(self)
or very similar