File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3966,6 +3966,7 @@ function TformTrayslate.TranslateThread(ATrans: TTranslate; AText: string; AMemo
39663966 UpdateTranslateButtonState;
39673967 Screen.Cursor := crAppStart;
39683968 TimerAnimate.Enabled := True;
3969+ Th.Start;
39693970 try
39703971 while Assigned(Th) and (not Th.Finished) do
39713972 begin
@@ -3992,8 +3993,10 @@ function TformTrayslate.TranslateThread(ATrans: TTranslate; AText: string; AMemo
39923993 finally
39933994 if Assigned(Th) then
39943995 begin
3995- Th.Free; // Th is nil if the thread was replaced/force-killed
39963996 FActiveThreads.Remove(Th);
3997+ if not Th.Finished then
3998+ Th.WaitFor;
3999+ Th.Free; // Th is nil if the thread was replaced/force-killed
39974000 end ;
39984001 FTranslateThread := nil ; // always clear shared reference
39994002 end ;
Original file line number Diff line number Diff line change @@ -1761,7 +1761,6 @@ constructor TTranslateThread.Create(ATrans: TTranslate; AFreeOnTerminate: boolea
17611761 FTrans := ATrans;
17621762 FSourceText := FTrans.TextToTranslate;
17631763 FCancelled := False;
1764- Start;
17651764end ;
17661765
17671766destructor TTranslateThread.Destroy;
You can’t perform that action at this time.
0 commit comments