Explorar o código

Fixed: Threads final execution app bug

PascalCoin %!s(int64=6) %!d(string=hai) anos
pai
achega
1fadade763
Modificáronse 1 ficheiros con 9 adicións e 7 borrados
  1. 9 7
      src/core/UThread.pas

+ 9 - 7
src/core/UThread.pas

@@ -144,13 +144,15 @@ begin
       end;
     End;
   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;