TApplication now frees only its components before finalization, not itself

git-svn-id: trunk@6860 -
This commit is contained in:
mattias 2005-02-28 16:52:24 +00:00
parent 374bd2d809
commit 1fe900aedb
4 changed files with 38 additions and 3 deletions

View File

@ -446,6 +446,8 @@ type
protected protected
procedure SetToolStatus(const AValue: TIDEToolStatus); override; procedure SetToolStatus(const AValue: TIDEToolStatus); override;
function DoResetToolStatus(Interactive: boolean): boolean; function DoResetToolStatus(Interactive: boolean): boolean;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure ToolButtonClick(Sender: TObject); procedure ToolButtonClick(Sender: TObject);
procedure OnApplyWindowLayout(ALayout: TIDEWindowLayout); procedure OnApplyWindowLayout(ALayout: TIDEWindowLayout);
@ -1051,6 +1053,8 @@ begin
// free IDE parts // free IDE parts
FreeFormEditor; FreeFormEditor;
FreeAndNil(FindReplaceDlg);
FreeAndNil(MessagesView);
FreeThenNil(AnchorDesigner); FreeThenNil(AnchorDesigner);
FreeThenNil(ObjectInspector1); FreeThenNil(ObjectInspector1);
FreeThenNil(GlobalDesignHook); FreeThenNil(GlobalDesignHook);
@ -1082,8 +1086,8 @@ end;
procedure TMainIDE.CreateOftenUsedForms; procedure TMainIDE.CreateOftenUsedForms;
begin begin
Application.CreateForm(TMessagesView, MessagesView); MessagesView:=TMessagesView.Create(nil);
Application.CreateForm(TLazFindReplaceDialog, FindReplaceDlg); FindReplaceDlg:=TLazFindReplaceDialog.Create(nil);
end; end;
procedure TMainIDE.CreateSearchResultWindow; procedure TMainIDE.CreateSearchResultWindow;
@ -2486,6 +2490,11 @@ begin
Result:=true; Result:=true;
end; end;
procedure TMainIDE.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
@ -11409,6 +11418,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.849 2005/02/28 16:52:24 mattias
TApplication now frees only its components before finalization, not itself
Revision 1.848 2005/02/25 21:55:44 mattias Revision 1.848 2005/02/25 21:55:44 mattias
added filter for open package/project/file added filter for open package/project/file

View File

@ -4277,6 +4277,7 @@ begin
// some action has changed the cursor during incremental search // some action has changed the cursor during incremental search
// -> end incremental search // -> end incremental search
EndIncrementalFind; EndIncrementalFind;
// this called UpdateStatusBar -> exit
exit; exit;
end; end;

View File

@ -942,6 +942,7 @@ type
procedure DoIdleActions; procedure DoIdleActions;
procedure MenuPopupHandler(Sender: TObject); procedure MenuPopupHandler(Sender: TObject);
procedure DoFreeReleaseComponents; procedure DoFreeReleaseComponents;
procedure DoBeforeFinalization;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -1284,7 +1285,7 @@ end;
procedure BeforeFinalization; procedure BeforeFinalization;
// This is our ExitProc handler. // This is our ExitProc handler.
begin begin
FreeInterfaceObject; Application.DoBeforeFinalization;
end; end;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -96,6 +96,7 @@ begin
inherited Create(AOwner); inherited Create(AOwner);
CaptureExceptions:=true; CaptureExceptions:=true;
FOldExitProc:=ExitProc; FOldExitProc:=ExitProc;
ExitProc:=@BeforeFinalization; ExitProc:=@BeforeFinalization;
end; end;
@ -186,6 +187,12 @@ begin
FMainForm:= nil; FMainForm:= nil;
Terminate; Terminate;
end; end;
if AComponent=FHintWindow then begin
FHintWindow:=nil;
end;
if AComponent=FHintTimer then begin
FHintTimer:=nil;
end;
end; end;
end; end;
@ -743,6 +750,17 @@ begin
FreeThenNil(FReleaseComponents); FreeThenNil(FReleaseComponents);
end; end;
procedure TApplication.DoBeforeFinalization;
var
i: Integer;
begin
if Self=nil then exit;
for i:=ComponentCount-1 downto 0 do begin
//debugln('TApplication.DoBeforeFinalization ',DbgSName(Components[i]));
if i<ComponentCount then Components[i].Free;
end;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TApplication.IconChanged Method: TApplication.IconChanged
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
@ -1418,6 +1436,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.105 2005/02/28 16:52:24 mattias
TApplication now frees only its components before finalization, not itself
Revision 1.104 2005/02/26 20:43:54 mattias Revision 1.104 2005/02/26 20:43:54 mattias
TApplication now uses ExitProc to free itself before all finaizations TApplication now uses ExitProc to free itself before all finaizations