mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 18:39:05 +02:00
IDE: Prevent crash when clicking button "Change Build Mode" and Cancel in dialog. BackupBuildModes is not called always. Issue #29292.
git-svn-id: trunk@51087 -
This commit is contained in:
parent
170279af46
commit
181b205220
24
ide/main.pp
24
ide/main.pp
@ -4935,10 +4935,9 @@ end;
|
|||||||
procedure TMainIDE.ComponentPaletteClassSelected(Sender: TObject);
|
procedure TMainIDE.ComponentPaletteClassSelected(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
// code below cant be handled correctly by integrated IDE
|
// code below cant be handled correctly by integrated IDE
|
||||||
if
|
if (IDETabMaster = nil) and (Screen.CustomFormZOrderCount > 1)
|
||||||
(IDETabMaster = nil) and
|
and Assigned(Screen.CustomFormsZOrdered[1].Designer) then
|
||||||
(Screen.CustomFormZOrderCount > 1)
|
begin
|
||||||
and Assigned(Screen.CustomFormsZOrdered[1].Designer) then begin
|
|
||||||
// previous active form was designer form
|
// previous active form was designer form
|
||||||
ShowDesignerForm(Screen.CustomFormsZOrdered[1]);
|
ShowDesignerForm(Screen.CustomFormsZOrdered[1]);
|
||||||
DoCallShowDesignerFormOfSourceHandler(lihtShowDesignerFormOfSource,
|
DoCallShowDesignerFormOfSourceHandler(lihtShowDesignerFormOfSource,
|
||||||
@ -6764,28 +6763,19 @@ begin
|
|||||||
DoBuildProject(crCompile, []);
|
DoBuildProject(crCompile, []);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoCompilerOptionsAfterWrite(Sender: TObject; Restore: boolean
|
procedure TMainIDE.DoCompilerOptionsAfterWrite(Sender: TObject; Restore: boolean);
|
||||||
);
|
|
||||||
var
|
var
|
||||||
AProject: TProject;
|
AProject: TProject;
|
||||||
aFilename: string;
|
aFilename: string;
|
||||||
begin
|
begin
|
||||||
AProject:=(Sender as TProjectCompilerOptions).Project;
|
AProject:=(Sender as TProjectCompilerOptions).Project;
|
||||||
|
|
||||||
if not Restore then
|
|
||||||
begin
|
|
||||||
AProject.DefineTemplates.AllChanged;
|
|
||||||
end;
|
|
||||||
if Restore then
|
if Restore then
|
||||||
begin
|
AProject.RestoreBuildModes
|
||||||
AProject.RestoreBuildModes;
|
else begin
|
||||||
end;
|
AProject.DefineTemplates.AllChanged;
|
||||||
|
|
||||||
IncreaseCompilerParseStamp;
|
IncreaseCompilerParseStamp;
|
||||||
MainBuildBoss.SetBuildTargetProject1(false);
|
MainBuildBoss.SetBuildTargetProject1(false);
|
||||||
|
|
||||||
if not Restore then
|
|
||||||
begin
|
|
||||||
if AProject.UseAsDefault then
|
if AProject.UseAsDefault then
|
||||||
begin
|
begin
|
||||||
// save as default
|
// save as default
|
||||||
|
@ -1041,7 +1041,6 @@ type
|
|||||||
write SetAutoOpenDesignerFormsDisabled;
|
write SetAutoOpenDesignerFormsDisabled;
|
||||||
property Bookmarks: TProjectBookmarkList read FBookmarks write FBookmarks;
|
property Bookmarks: TProjectBookmarkList read FBookmarks write FBookmarks;
|
||||||
property BuildModes: TProjectBuildModes read FBuildModes;
|
property BuildModes: TProjectBuildModes read FBuildModes;
|
||||||
property BuildModesBackup: TProjectBuildModes read FBuildModesBackup;
|
|
||||||
property SkipCheckLCLInterfaces: boolean read FSkipCheckLCLInterfaces
|
property SkipCheckLCLInterfaces: boolean read FSkipCheckLCLInterfaces
|
||||||
write SetSkipCheckLCLInterfaces;
|
write SetSkipCheckLCLInterfaces;
|
||||||
property CompilerOptions: TProjectCompilerOptions read GetCompilerOptions;
|
property CompilerOptions: TProjectCompilerOptions read GetCompilerOptions;
|
||||||
@ -3403,7 +3402,7 @@ begin
|
|||||||
{$IFDEF VerboseIDEModified}
|
{$IFDEF VerboseIDEModified}
|
||||||
debugln(['TProject.BackupBuildModes START=====================']);
|
debugln(['TProject.BackupBuildModes START=====================']);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
BuildModesBackup.Assign(BuildModes,true);
|
FBuildModesBackup.Assign(BuildModes,true);
|
||||||
{$IFDEF VerboseIDEModified}
|
{$IFDEF VerboseIDEModified}
|
||||||
debugln(['TProject.BackupBuildModes END===================== Modified=',Modified]);
|
debugln(['TProject.BackupBuildModes END===================== Modified=',Modified]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -3411,13 +3410,16 @@ end;
|
|||||||
|
|
||||||
procedure TProject.RestoreBuildModes;
|
procedure TProject.RestoreBuildModes;
|
||||||
begin
|
begin
|
||||||
|
if FBuildModesBackup.Count = 0 then Exit;
|
||||||
ActiveBuildMode:=nil;
|
ActiveBuildMode:=nil;
|
||||||
BuildModes.Assign(BuildModesBackup,true);
|
BuildModes.Assign(FBuildModesBackup,true);
|
||||||
if (FActiveBuildModeBackup>=0) and (FActiveBuildModeBackup<BuildModes.Count)
|
if (FActiveBuildModeBackup>=0) and (FActiveBuildModeBackup<BuildModes.Count)
|
||||||
then
|
then
|
||||||
ActiveBuildMode:=BuildModes[FActiveBuildModeBackup]
|
ActiveBuildMode:=BuildModes[FActiveBuildModeBackup]
|
||||||
else
|
else
|
||||||
ActiveBuildMode:=BuildModes[0];
|
ActiveBuildMode:=BuildModes[0];
|
||||||
|
// Must be cleared for the next time because BackupBuildModes may not be called.
|
||||||
|
FBuildModesBackup.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProject.GetTitle: string;
|
function TProject.GetTitle: string;
|
||||||
@ -7166,8 +7168,7 @@ begin
|
|||||||
SharedMatrixOptions.SaveToXMLConfig(FXMLConfig, Path+'BuildModes/SharedMatrixOptions/',@IsSharedMode);
|
SharedMatrixOptions.SaveToXMLConfig(FXMLConfig, Path+'BuildModes/SharedMatrixOptions/',@IsSharedMode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProjectBuildModes.GetLazBuildModes(Index: integer
|
function TProjectBuildModes.GetLazBuildModes(Index: integer): TLazProjectBuildMode;
|
||||||
): TLazProjectBuildMode;
|
|
||||||
begin
|
begin
|
||||||
Result:=TLazProjectBuildMode(fItems[Index]);
|
Result:=TLazProjectBuildMode(fItems[Index]);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user