From 6990c213d35e9e2ea2a0db2bcb110265ad6f5101 Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 13 Mar 2010 16:43:44 +0000 Subject: [PATCH] ide: compiler options: fix logic of loading from the configuration file (issue #0015625) git-svn-id: trunk@23975 - --- ide/frames/compiler_other_options.pas | 12 ++++++++++-- ide/frames/compiler_path_options.pas | 15 ++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ide/frames/compiler_other_options.pas b/ide/frames/compiler_other_options.pas index 05b3303271..65b9b7d9ce 100644 --- a/ide/frames/compiler_other_options.pas +++ b/ide/frames/compiler_other_options.pas @@ -23,6 +23,7 @@ type private FOptions: TBaseCompilerOptions; public + constructor Create(TheOwner: TComponent); override; function Check: Boolean; override; function GetTitle: string; override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; @@ -42,6 +43,12 @@ begin edtConfigPath.Enabled := chkCustomConfigFile.Checked; end; +constructor TCompilerOtherOptionsFrame.Create(TheOwner: TComponent); +begin + inherited Create(TheOwner); + FOptions := nil; +end; + function TCompilerOtherOptionsFrame.Check: Boolean; var NewDontUseConfigFile: Boolean; @@ -94,8 +101,9 @@ end; procedure TCompilerOtherOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); begin - FOptions := AOptions as TBaseCompilerOptions; - with FOptions do + if FOptions = nil then + FOptions := AOptions as TBaseCompilerOptions; + with AOptions as TBaseCompilerOptions do begin chkConfigFile.Checked := not DontUseConfigFile; chkCustomConfigFile.Checked := CustomConfigFile; diff --git a/ide/frames/compiler_path_options.pas b/ide/frames/compiler_path_options.pas index f6d911cc54..4bfbead74e 100644 --- a/ide/frames/compiler_path_options.pas +++ b/ide/frames/compiler_path_options.pas @@ -52,6 +52,7 @@ type protected procedure DoSaveSettings(AOptions: TAbstractIDEOptions); public + constructor Create(TheOwner: TComponent); override; function Check: boolean; override; function GetTitle: string; override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; @@ -160,11 +161,9 @@ end; procedure TCompilerPathOptionsFrame.DoLoadSave(Sender: TObject); var - OldOptions: TBaseCompilerOptions; Options: TBaseCompilerOptions; ImportExportResult: TImportExportOptionsResult; begin - OldOptions := FCompilerOpts; Options := TBaseCompilerOptionsClass(FCompilerOpts.ClassType).Create(FCompilerOpts.Owner); try DoSaveSettings(Options); @@ -174,7 +173,6 @@ begin if Assigned(OnLoadIDEOptions) then OnLoadIDEOptions(Self, Options); end; - Options := OldOptions; finally Options.Free; end; @@ -186,6 +184,12 @@ begin OnSaveIDEOptions(Self, AOptions); end; +constructor TCompilerPathOptionsFrame.Create(TheOwner: TComponent); +begin + inherited Create(TheOwner); + FCompilerOpts := nil; +end; + function TCompilerPathOptionsFrame.CheckSearchPath(const Context, ExpandedPath: string; Level: TCheckCompileOptionsMsgLvl): boolean; var @@ -562,8 +566,9 @@ procedure TCompilerPathOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); var LCLPlatform: TLCLPlatform; begin - FCompilerOpts := AOptions as TBaseCompilerOptions; - with FCompilerOpts do + if FCompilerOpts = nil then + FCompilerOpts := AOptions as TBaseCompilerOptions; + with AOptions as TBaseCompilerOptions do begin edtOtherUnits.Text := OtherUnitFiles; edtIncludeFiles.Text := IncludePath;