mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 08:47:59 +02:00
IDE: Improve removing unknown component properties. Issue #40377.
This commit is contained in:
parent
e4494cf4cd
commit
d9608a3489
12
ide/main.pp
12
ide/main.pp
@ -8502,6 +8502,9 @@ begin
|
||||
end;
|
||||
|
||||
function TMainIDE.PrepareForCompile: TModalResult;
|
||||
var
|
||||
AnUnitInfo: TUnitInfo;
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=mrOk;
|
||||
if ToolStatus=itDebugger then begin
|
||||
@ -8520,6 +8523,15 @@ begin
|
||||
if MainBuildBoss.CompilerOnDiskChanged then
|
||||
MainBuildBoss.RescanCompilerDefines(false,false,false,false);
|
||||
|
||||
// Let a user fix any invalid LFM files before compiling
|
||||
for i:=0 to Project1.AllEditorsInfoCount-1 do begin
|
||||
AnUnitInfo:=Project1.AllEditorsInfo[i].UnitInfo;
|
||||
if AnUnitInfo.HasErrorInLFM then begin
|
||||
Result:=LoadLFM(AnUnitInfo, [ofOnlyIfExists], []);
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
if (IDEMessagesWindow<>nil) and (ExternalToolsRef.RunningCount=0) then
|
||||
IDEMessagesWindow.Clear;
|
||||
end;
|
||||
|
@ -288,6 +288,7 @@ type
|
||||
fLoaded: Boolean; // loaded in the source editor, needed to restore open files
|
||||
fLoadedDesigner: Boolean; // has a visible designer, needed to restore open designers
|
||||
FLoadingComponent: boolean;
|
||||
fHasErrorInLFM: boolean;
|
||||
fModified: boolean;
|
||||
fNext, fPrev: array[TUnitInfoList] of TUnitInfo;
|
||||
fOnFileBackup: TOnFileBackup;
|
||||
@ -471,6 +472,7 @@ type
|
||||
property Loaded: Boolean read fLoaded write SetLoaded;
|
||||
property LoadedDesigner: Boolean read fLoadedDesigner write SetLoadedDesigner;
|
||||
property LoadingComponent: boolean read FLoadingComponent write FLoadingComponent;
|
||||
property HasErrorInLFM: boolean read fHasErrorInLFM write fHasErrorInLFM;
|
||||
property Modified: boolean read GetModified write SetModified;// not Session data
|
||||
property SessionModified: boolean read FSessionModified write SetSessionModified;
|
||||
property OnFileBackup: TOnFileBackup read fOnFileBackup write fOnFileBackup;
|
||||
|
@ -6277,10 +6277,13 @@ begin
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
// Error streaming component -> examine lfm file,
|
||||
// but not when opening project. It would open many lfm file copies.
|
||||
if ofProjectLoading in OpenFlags then exit;
|
||||
DebugLn('LoadLFM ERROR: streaming failed lfm="',LFMBuf.Filename,'"');
|
||||
// Error streaming component -> examine lfm file
|
||||
// but not when opening a project. It would open many lfm file copies.
|
||||
DebugLn('LoadLFM ERROR: streaming failed. Unit="', AnUnitInfo.Filename, '", lfm="', LFMBuf.Filename,'"');
|
||||
if ofProjectLoading in OpenFlags then begin
|
||||
AnUnitInfo.HasErrorInLFM:=True;
|
||||
exit;
|
||||
end;
|
||||
// open lfm file in editor
|
||||
if AnUnitInfo.OpenEditorInfoCount > 0 then
|
||||
Result:=OpenEditorFile(LFMBuf.Filename,
|
||||
@ -6296,7 +6299,10 @@ begin
|
||||
end;
|
||||
LFMUnitInfo:=Project1.UnitWithEditorComponent(SourceEditorManager.ActiveEditor);
|
||||
Result:=CheckLFMInEditor(LFMUnitInfo, true);
|
||||
if Result=mrOk then Result:=mrCancel;
|
||||
if Result=mrOk then begin
|
||||
AnUnitInfo.HasErrorInLFM:=False;
|
||||
Result:=mrCancel;
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
finally
|
||||
|
Loading…
Reference in New Issue
Block a user