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; 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

View File

@ -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