mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 11:19:24 +02:00
Converter: fix a memory leak when converting a single unit.
git-svn-id: trunk@39670 -
This commit is contained in:
parent
15f0c7aa65
commit
289e83d1dd
@ -866,34 +866,39 @@ var
|
|||||||
begin
|
begin
|
||||||
IDEMessagesWindow.Clear;
|
IDEMessagesWindow.Clear;
|
||||||
DelphiUnit := TDelphiUnit.Create(Self, fOrigFilename, []);
|
DelphiUnit := TDelphiUnit.Create(Self, fOrigFilename, []);
|
||||||
Result:=fSettings.RunForm(Nil);
|
try
|
||||||
if Result=mrOK then
|
Result:=fSettings.RunForm(Nil);
|
||||||
with DelphiUnit do
|
if Result=mrOK then begin
|
||||||
try
|
with DelphiUnit do
|
||||||
Result:=CopyAndLoadFile;
|
try
|
||||||
if Result=mrOK then begin
|
Result:=CopyAndLoadFile;
|
||||||
Result:=ConvertUnitFile;
|
if Result=mrOK then begin
|
||||||
if Result=mrOk then begin
|
Result:=ConvertUnitFile;
|
||||||
Result:=SaveCodeBufferToFile(fPascalBuffer,fLazUnitFilename);
|
|
||||||
if Result=mrOk then begin
|
if Result=mrOk then begin
|
||||||
Result:=LazarusIDE.DoOpenEditorFile(fLazUnitFilename,0,0,
|
Result:=SaveCodeBufferToFile(fPascalBuffer,fLazUnitFilename);
|
||||||
[ofAddToRecent,ofQuiet]);
|
|
||||||
if Result=mrOk then begin
|
if Result=mrOk then begin
|
||||||
Result:=ConvertFormFile;
|
Result:=LazarusIDE.DoOpenEditorFile(fLazUnitFilename,0,0,
|
||||||
|
[ofAddToRecent,ofQuiet]);
|
||||||
|
if Result=mrOk then begin
|
||||||
|
Result:=ConvertFormFile;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
except
|
||||||
|
on e: EDelphiConverterError do begin
|
||||||
|
fErrorMsg:=e.Message;
|
||||||
|
end;
|
||||||
|
else begin
|
||||||
|
fErrorMsg:=CodeToolBoss.ErrorMessage;
|
||||||
|
end;
|
||||||
|
Result:=mrAbort;
|
||||||
end;
|
end;
|
||||||
except
|
|
||||||
on e: EDelphiConverterError do begin
|
|
||||||
fErrorMsg:=e.Message;
|
|
||||||
end;
|
|
||||||
else begin
|
|
||||||
fErrorMsg:=CodeToolBoss.ErrorMessage;
|
|
||||||
end;
|
|
||||||
Result:=mrAbort;
|
|
||||||
end;
|
end;
|
||||||
ShowEndingMessage(Result);
|
ShowEndingMessage(Result);
|
||||||
|
finally
|
||||||
|
DelphiUnit.Free;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TConvertDelphiProjPack }
|
{ TConvertDelphiProjPack }
|
||||||
@ -1311,8 +1316,7 @@ end;
|
|||||||
|
|
||||||
destructor TConvertDelphiProject.Destroy;
|
destructor TConvertDelphiProject.Destroy;
|
||||||
begin
|
begin
|
||||||
if Assigned(fMainUnitConverter) then
|
fMainUnitConverter.Free;
|
||||||
fMainUnitConverter.Free;
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user