mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 19:20:17 +02:00
Converter: Do not free CacheUnitsThread automatically on terminate. Fixes a memory leak when conversion is aborted.
git-svn-id: trunk@53894 -
This commit is contained in:
parent
662bc7f0d2
commit
5f92759f52
@ -1033,6 +1033,7 @@ begin
|
|||||||
Result:=mrAbort;
|
Result:=mrAbort;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
CacheUnitsThread.Free;
|
||||||
EndTime:=Now;
|
EndTime:=Now;
|
||||||
s:=FormatDateTime('hh:nn:ss', EndTime-StartTime);
|
s:=FormatDateTime('hh:nn:ss', EndTime-StartTime);
|
||||||
if (Result<>mrAbort) and (s<>'00:00:00') then
|
if (Result<>mrAbort) and (s<>'00:00:00') then
|
||||||
|
@ -212,7 +212,6 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent; ASettings: TConvertSettings); reintroduce;
|
constructor Create(AOwner: TComponent; ASettings: TConvertSettings); reintroduce;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
property CacheUnitsThread: TThread read fCacheUnitsThread;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -853,8 +852,6 @@ end;
|
|||||||
|
|
||||||
destructor TConvertSettingsForm.Destroy;
|
destructor TConvertSettingsForm.Destroy;
|
||||||
begin
|
begin
|
||||||
if Assigned(fCacheUnitsThread) and not fThreadStarted then
|
|
||||||
fCacheUnitsThread.Free;
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -966,7 +963,6 @@ begin
|
|||||||
if ScanParentDirCheckBox.Checked and Assigned(fCacheUnitsThread) then
|
if ScanParentDirCheckBox.Checked and Assigned(fCacheUnitsThread) then
|
||||||
begin
|
begin
|
||||||
ThreadGuiShow(True);
|
ThreadGuiShow(True);
|
||||||
fCacheUnitsThread.FreeOnTerminate:=True;
|
|
||||||
fCacheUnitsThread.OnTerminate:=@ThreadTerminated;
|
fCacheUnitsThread.OnTerminate:=@ThreadTerminated;
|
||||||
fCacheUnitsThread.Start;
|
fCacheUnitsThread.Start;
|
||||||
fThreadStarted := True;
|
fThreadStarted := True;
|
||||||
@ -1002,7 +998,6 @@ end;
|
|||||||
procedure TConvertSettingsForm.ThreadTerminated(Sender: TObject);
|
procedure TConvertSettingsForm.ThreadTerminated(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ThreadGuiShow(False);
|
ThreadGuiShow(False);
|
||||||
fCacheUnitsThread := nil; // Thread frees itself. Make the variable nil, too.
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Edit replacements in grids
|
// Edit replacements in grids
|
||||||
|
Loading…
Reference in New Issue
Block a user