diff --git a/components/multithreadprocs/mtprocs.pas b/components/multithreadprocs/mtprocs.pas index 225014b6b..af657df28 100644 --- a/components/multithreadprocs/mtprocs.pas +++ b/components/multithreadprocs/mtprocs.pas @@ -311,12 +311,12 @@ var ok: Boolean; E: Exception; begin - Group:=Item.Group; - aPool:=Group.Pool; + aPool:=Item.Group.Pool; ok:=false; try repeat // work + Group:=Item.Group; Group.Run(Item.Index,Group.TaskData,Item); aPool.EnterPoolCriticalSection; @@ -352,7 +352,7 @@ begin // wait for new work if Item.FState=mtptsInactive then RTLeventWaitFor(Item.fWaitForPool); - until Group=nil; + until Item.Group=nil; ok:=true; except // stop the exception and store it