瀏覽代碼

Fixed: Threads final execution app bug

PascalCoin 6 年之前
父節點
當前提交
1fadade763
共有 1 個文件被更改,包括 9 次插入7 次删除
  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;