Converter,IDE: Read full component info from .lfm file to UnitInfo. Don't generate resources when there aren't any yet. Issue #40132.

This commit is contained in:
Juha 2023-02-26 20:38:02 +02:00
parent aa5f5e9d1b
commit 68eb8b0232
3 changed files with 9 additions and 5 deletions

View File

@ -46,7 +46,7 @@ uses
// IDE
IDEProcs, DialogProcs, CompilerOptions, ProjPackCommon, Project,
ProjectDescriptorTypes, PackageDefs, PackageSystem, PackageEditor,
BasePkgManager, LazarusIDEStrConsts, SearchPathProcs,
BasePkgManager, LazarusIDEStrConsts, SearchPathProcs, SourceFileManager,
// Converter
ConverterTypes, ConvertSettings, ConvCodeTool, MissingUnits, MissingPropertiesDlg,
UsedUnits;
@ -619,6 +619,8 @@ begin
if not fOwnerConverter.fSettings.SameDfmFile then
Result:=LoadCodeBuffer(fLFMBuffer,LfmFilename,
[lbfCheckIfText,lbfUpdateFromDisk],true);
if fUnitInfo<>nil then
Result:=LoadLFM(fUnitInfo,fLFMBuffer,[ofOnlyIfExists],[]);
end;
end;

View File

@ -2083,7 +2083,8 @@ var
begin
Result:=mrOk;
// update project resource
Project1.ProjResources.Regenerate(Project1.MainFileName, False, True, TestDir);
if Project1.MainUnitID>=0 then
Project1.ProjResources.Regenerate(Project1.MainFileName, False, True, TestDir);
AnUnitInfo := Project1.FirstPartOfProject;
while AnUnitInfo<>nil do
begin

View File

@ -3676,8 +3676,9 @@ begin
ActiveModeName:=Modes[0].Name;
// init resource files
if not Project1.ProjResources.Regenerate(Project1.MainFilename, True, False,'') then
DebugLn('InitNewProject Project1.Resources.Regenerate failed');
if Project1.MainUnitID>=0 then
if not Project1.ProjResources.Regenerate(Project1.MainFilename, True, False,'') then
DebugLn('InitNewProject Project1.Resources.Regenerate failed');
finally
Project1.EndUpdate;
end;
@ -6307,7 +6308,7 @@ var
UnitCode, LFMCode: TCodeBuffer;
begin
if Project1=nil then exit(mrCancel);
// try to find a unit name without expaning the path. this is required if unit is virtual
// try to find a unit name without expanding the path. this is required if unit is virtual
// in other case file name will be expanded with the wrong path
AFilename:=UnitFilename;
AnUnitInfo:=Project1.UnitInfoWithFilename(AFilename);