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:
juha 2017-01-06 14:03:22 +00:00
parent 662bc7f0d2
commit 5f92759f52
2 changed files with 1 additions and 5 deletions

View File

@ -1033,6 +1033,7 @@ begin
Result:=mrAbort;
end;
finally
CacheUnitsThread.Free;
EndTime:=Now;
s:=FormatDateTime('hh:nn:ss', EndTime-StartTime);
if (Result<>mrAbort) and (s<>'00:00:00') then

View File

@ -212,7 +212,6 @@ type
public
constructor Create(AOwner: TComponent; ASettings: TConvertSettings); reintroduce;
destructor Destroy; override;
property CacheUnitsThread: TThread read fCacheUnitsThread;
end;
@ -853,8 +852,6 @@ end;
destructor TConvertSettingsForm.Destroy;
begin
if Assigned(fCacheUnitsThread) and not fThreadStarted then
fCacheUnitsThread.Free;
inherited Destroy;
end;
@ -966,7 +963,6 @@ begin
if ScanParentDirCheckBox.Checked and Assigned(fCacheUnitsThread) then
begin
ThreadGuiShow(True);
fCacheUnitsThread.FreeOnTerminate:=True;
fCacheUnitsThread.OnTerminate:=@ThreadTerminated;
fCacheUnitsThread.Start;
fThreadStarted := True;
@ -1002,7 +998,6 @@ end;
procedure TConvertSettingsForm.ThreadTerminated(Sender: TObject);
begin
ThreadGuiShow(False);
fCacheUnitsThread := nil; // Thread frees itself. Make the variable nil, too.
end;
// Edit replacements in grids