Browse Source

Fixed: Threads final execution app bug

PascalCoin 6 years ago
parent
commit
1fadade763
1 changed files with 9 additions and 7 deletions
  1. 9 7
      src/core/UThread.pas

+ 9 - 7
src/core/UThread.pas

@@ -144,13 +144,15 @@ begin
       end;
       end;
     End;
     End;
   finally
   finally
-    l := _threads.LockList;
-    Try
-      i := l.Remove(Self);
-      {$IFDEF HIGHLOG}TLog.NewLog(ltdebug,Classname,'Finalizing Thread in pos '+inttostr(i+1)+'/'+inttostr(l.Count+1)+' working time: '+FormatFloat('0.000',TPlatform.GetElapsedMilliseconds(FStartTickCount) / 1000)+' sec');{$ENDIF}
-    Finally
-      _threads.UnlockList;
-    End;
+    if Assigned(_threads) then begin
+      l := _threads.LockList;
+      Try
+        i := l.Remove(Self);
+        {$IFDEF HIGHLOG}TLog.NewLog(ltdebug,Classname,'Finalizing Thread in pos '+inttostr(i+1)+'/'+inttostr(l.Count+1)+' working time: '+FormatFloat('0.000',TPlatform.GetElapsedMilliseconds(FStartTickCount) / 1000)+' sec');{$ENDIF}
+      Finally
+        _threads.UnlockList;
+      End;
+    end;
   end;
   end;
 end;
 end;