* Patch from Martin to set FCloseHandleOnExecute before invoking OnGetHandle - the handler might change it

This commit is contained in:
Michaël Van Canneyt 2024-02-04 10:47:37 +01:00
parent 8c8b336914
commit 299c90b91d

View File

@ -1180,6 +1180,7 @@ begin
begin begin
FTheirHandleIOType := IOType; FTheirHandleIOType := IOType;
FOurHandle:=THAndle(INVALID_HANDLE_VALUE); FOurHandle:=THAndle(INVALID_HANDLE_VALUE);
FCloseHandleOnExecute:=(IOType<>iotDefault);
Case IOType of Case IOType of
iotDefault : H:=CreateStandardHandle; iotDefault : H:=CreateStandardHandle;
iotPipe : H:=CreatePipeHandle; iotPipe : H:=CreatePipeHandle;
@ -1188,7 +1189,6 @@ begin
iotHandle : H:=CreateCustomHandle; iotHandle : H:=CreateCustomHandle;
iotNull : H:=CreateNullFileHandle; iotNull : H:=CreateNullFileHandle;
end; end;
FCloseHandleOnExecute:=(IOType<>iotDefault);
FTheirHandle:=PrepareCreatedHandleForProcess(H); FTheirHandle:=PrepareCreatedHandleForProcess(H);
if Assigned(FAfterAllocateHandle) then if Assigned(FAfterAllocateHandle) then
FAfterAllocateHandle(Self,FTheirHandle,FCloseHandleOnExecute); FAfterAllocateHandle(Self,FTheirHandle,FCloseHandleOnExecute);